mirror of
https://github.com/zombieFox/nightTab.git
synced 2025-02-16 18:20:49 +01:00
[feature] improve initial background colour
This commit is contained in:
parent
cc1102a1bd
commit
a63116ef0d
16
gulpfile.js
16
gulpfile.js
@ -154,6 +154,10 @@ const build = {
|
|||||||
.pipe(dest(path.build + '/js', {
|
.pipe(dest(path.build + '/js', {
|
||||||
sourcemaps: '.'
|
sourcemaps: '.'
|
||||||
}))
|
}))
|
||||||
|
},
|
||||||
|
initialBackground: function() {
|
||||||
|
return src(path.src + '/js/initial-background.js')
|
||||||
|
.pipe(dest(path.build + '/js'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,8 +213,16 @@ const dev = {
|
|||||||
return src(jsFiles)
|
return src(jsFiles)
|
||||||
.pipe(dest(path.dev + '/js'))
|
.pipe(dest(path.dev + '/js'))
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
initialBackground: function() {
|
||||||
|
watch(path.src + '/js/initial-background.js', {
|
||||||
|
ignoreInitial: false
|
||||||
|
}, function() {
|
||||||
|
return src(path.src + '/js/initial-background.js')
|
||||||
|
.pipe(dest(path.dev + '/js'))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.dev = parallel(dev.manifest, dev.html, dev.fonts, dev.icons, dev.css, dev.js)
|
exports.dev = parallel(dev.manifest, dev.html, dev.fonts, dev.icons, dev.css, dev.js, dev.initialBackground)
|
||||||
exports.build = parallel(build.manifest, build.html, build.fonts, build.icons, build.css, build.js)
|
exports.build = parallel(build.manifest, build.html, build.fonts, build.icons, build.css, build.js, build.initialBackground)
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nightTab",
|
"name": "nightTab",
|
||||||
"version": "5.76.0",
|
"version": "5.77.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nightTab",
|
"name": "nightTab",
|
||||||
"version": "5.76.0",
|
"version": "5.77.0",
|
||||||
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||||
<title>New Tab</title>
|
<title>New Tab</title>
|
||||||
|
|
||||||
<style media="screen">
|
<style media="screen" type="text/css">
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
|
|
||||||
html,
|
html,
|
||||||
@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
@@include("./html/link-css.html")
|
@@include("./html/link-css.html")
|
||||||
|
|
||||||
|
<script src="js/initial-background.js" async></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
15
src/js/initial-background.js
Normal file
15
src/js/initial-background.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// inital check for systems which do not have light or dark mode
|
||||||
|
if (localStorage.getItem("nightTabStyle")) {
|
||||||
|
var style = document.createElement("style");
|
||||||
|
style.type = "text/css";
|
||||||
|
style.media = "screen";
|
||||||
|
switch (localStorage.getItem("nightTabStyle")) {
|
||||||
|
case "light":
|
||||||
|
style.innerHTML = "html, body {background-color: rgb(255, 255, 255);}";
|
||||||
|
break;
|
||||||
|
case "dark":
|
||||||
|
style.innerHTML = "html, body {background-color: rgb(0, 0, 0);}";
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
document.querySelector("head").appendChild(style);
|
||||||
|
};
|
@ -124,12 +124,16 @@ var theme = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
mod.style = {
|
mod.style = {
|
||||||
|
save: function() {
|
||||||
|
data.mod.set("nightTabStyle", state.get.current().theme.style);
|
||||||
|
},
|
||||||
light: function() {
|
light: function() {
|
||||||
helper.setObject({
|
helper.setObject({
|
||||||
object: state.get.current(),
|
object: state.get.current(),
|
||||||
path: "theme.style",
|
path: "theme.style",
|
||||||
newValue: "light"
|
newValue: "light"
|
||||||
});
|
});
|
||||||
|
mod.style.save();
|
||||||
},
|
},
|
||||||
dark: function() {
|
dark: function() {
|
||||||
helper.setObject({
|
helper.setObject({
|
||||||
@ -137,6 +141,7 @@ var theme = (function() {
|
|||||||
path: "theme.style",
|
path: "theme.style",
|
||||||
newValue: "dark"
|
newValue: "dark"
|
||||||
});
|
});
|
||||||
|
mod.style.save();
|
||||||
},
|
},
|
||||||
system: function() {
|
system: function() {
|
||||||
helper.setObject({
|
helper.setObject({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var version = (function() {
|
var version = (function() {
|
||||||
|
|
||||||
var current = "5.76.0";
|
var current = "5.77.0";
|
||||||
|
|
||||||
var name = "Jaded Raven";
|
var name = "Jaded Raven";
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "nightTab",
|
"name": "nightTab",
|
||||||
"short_name": "nightTab",
|
"short_name": "nightTab",
|
||||||
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
||||||
"version": "5.76.0",
|
"version": "5.77.0",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"chrome_url_overrides": {
|
"chrome_url_overrides": {
|
||||||
"newtab": "index.html"
|
"newtab": "index.html"
|
||||||
|
Loading…
Reference in New Issue
Block a user