mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-11-22 08:03:18 +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', {
|
||||
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)
|
||||
.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.build = parallel(build.manifest, build.html, build.fonts, build.icons, build.css, build.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, build.initialBackground)
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nightTab",
|
||||
"version": "5.76.0",
|
||||
"version": "5.77.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<title>New Tab</title>
|
||||
|
||||
<style media="screen">
|
||||
<style media="screen" type="text/css">
|
||||
@media (prefers-color-scheme: dark) {
|
||||
|
||||
html,
|
||||
@ -26,6 +26,8 @@
|
||||
|
||||
@@include("./html/link-css.html")
|
||||
|
||||
<script src="js/initial-background.js" async></script>
|
||||
|
||||
</head>
|
||||
|
||||
<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 = {
|
||||
save: function() {
|
||||
data.mod.set("nightTabStyle", state.get.current().theme.style);
|
||||
},
|
||||
light: function() {
|
||||
helper.setObject({
|
||||
object: state.get.current(),
|
||||
path: "theme.style",
|
||||
newValue: "light"
|
||||
});
|
||||
mod.style.save();
|
||||
},
|
||||
dark: function() {
|
||||
helper.setObject({
|
||||
@ -137,6 +141,7 @@ var theme = (function() {
|
||||
path: "theme.style",
|
||||
newValue: "dark"
|
||||
});
|
||||
mod.style.save();
|
||||
},
|
||||
system: function() {
|
||||
helper.setObject({
|
||||
|
@ -1,6 +1,6 @@
|
||||
var version = (function() {
|
||||
|
||||
var current = "5.76.0";
|
||||
var current = "5.77.0";
|
||||
|
||||
var name = "Jaded Raven";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
"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.",
|
||||
"version": "5.76.0",
|
||||
"version": "5.77.0",
|
||||
"manifest_version": 2,
|
||||
"chrome_url_overrides": {
|
||||
"newtab": "index.html"
|
||||
|
Loading…
Reference in New Issue
Block a user