mirror of
https://github.com/zombieFox/nightTab.git
synced 2025-06-26 12:31:47 +02:00
[feature] add background colour controls
This commit is contained in:
parent
682b238c0f
commit
cc40feee5e
@ -8,7 +8,6 @@ html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: var(--background);
|
|
||||||
color: rgb(var(--theme-style-text));
|
color: rgb(var(--theme-style-text));
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
@ -21,6 +20,14 @@ body {
|
|||||||
transition: background-color var(--layout-timing-extra-fast);
|
transition: background-color var(--layout-timing-extra-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.is-background-color-by-theme body {
|
||||||
|
background-color: var(--background-color-theme);
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-background-color-by-custom body {
|
||||||
|
background-color: var(--background-color-custom);
|
||||||
|
}
|
||||||
|
|
||||||
.is-layout-scrollpastend body {
|
.is-layout-scrollpastend body {
|
||||||
margin-bottom: 40vh;
|
margin-bottom: 40vh;
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,8 @@ input[type="color"]:focus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
input[type="color"][disabled] {
|
input[type="color"][disabled] {
|
||||||
opacity: 0.5;
|
opacity: 0.25;
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="color"][disabled]:hover,
|
input[type="color"][disabled]:hover,
|
||||||
|
@ -60,7 +60,8 @@
|
|||||||
--layout-shadow-medium: 0 2px 4px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.2);
|
--layout-shadow-medium: 0 2px 4px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||||
--layout-shadow-large: 0 3px 6px rgba(0, 0, 0, 0.1), 0 6px 12px rgba(0, 0, 0, 0.2);
|
--layout-shadow-large: 0 3px 6px rgba(0, 0, 0, 0.1), 0 6px 12px rgba(0, 0, 0, 0.2);
|
||||||
/* background */
|
/* background */
|
||||||
--background: rgb(var(--theme-gray-01));
|
--background-color-theme: rgb(var(--theme-gray-01));
|
||||||
|
--background-color-custom: rgb(0, 0, 0);
|
||||||
--background-image: none;
|
--background-image: none;
|
||||||
--background-opacity: 1;
|
--background-opacity: 1;
|
||||||
--background-scale: 1;
|
--background-scale: 1;
|
||||||
|
@ -1026,6 +1026,28 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="menu-content-area menu-content-area-background is-hidden">
|
<div class="menu-content-area menu-content-area-background is-hidden">
|
||||||
|
<div class="menu-item">
|
||||||
|
<div class="menu-item-header">
|
||||||
|
<h1 class="menu-item-header-text">Colour</h1>
|
||||||
|
</div>
|
||||||
|
<div class="menu-item-form">
|
||||||
|
<div class="input-wrap">
|
||||||
|
<input id="control-background-color-by-theme" class="control-background-color-by-theme" type="radio" name="control-background-color-by" value="theme" tabindex="-1">
|
||||||
|
<label for="control-background-color-by-theme">Theme background colour</label>
|
||||||
|
</div>
|
||||||
|
<p class="control-background-color-by-theme-helper form-helper small">Background colour defined by the Dark or Light Theme.</p>
|
||||||
|
<div class="input-wrap">
|
||||||
|
<input id="control-background-color-by-custom" class="control-background-color-by-custom" type="radio" name="control-background-color-by" value="custom" tabindex="-1">
|
||||||
|
<label for="control-background-color-by-custom">Custom background colour</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-indent">
|
||||||
|
<div class="input-wrap">
|
||||||
|
<input id="control-background-color-custom-current" class="control-background-color-custom-current mb-0" type="color" tabindex="1">
|
||||||
|
</div>
|
||||||
|
<p class="control-background-color-theme-helper form-helper small">Take care as some colours may make the Clock, Date and other text unreadable.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="menu-item">
|
<div class="menu-item">
|
||||||
<div class="menu-item-header">
|
<div class="menu-item-header">
|
||||||
<h1 class="menu-item-header-text">Image</h1>
|
<h1 class="menu-item-header-text">Image</h1>
|
||||||
|
@ -69,6 +69,11 @@ var background = (function() {
|
|||||||
|
|
||||||
var render = {};
|
var render = {};
|
||||||
|
|
||||||
|
render.color = function() {
|
||||||
|
var html = helper.e("html");
|
||||||
|
html.style.setProperty("--background-color-custom", "rgb(" + state.get().background.color.custom.r + ", " + state.get().background.color.custom.g + ", " + state.get().background.color.custom.b + ")");
|
||||||
|
};
|
||||||
|
|
||||||
render.image = function() {
|
render.image = function() {
|
||||||
var html = helper.e("html");
|
var html = helper.e("html");
|
||||||
if (state.get().background.image.show) {
|
if (state.get().background.image.show) {
|
||||||
@ -209,6 +214,7 @@ var background = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var init = function() {
|
var init = function() {
|
||||||
|
render.color();
|
||||||
render.image();
|
render.image();
|
||||||
render.blur();
|
render.blur();
|
||||||
render.grayscale();
|
render.grayscale();
|
||||||
|
@ -2097,6 +2097,29 @@ var control = (function() {
|
|||||||
theme.render.accent.color();
|
theme.render.accent.color();
|
||||||
link.items();
|
link.items();
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
element: helper.e(".control-background-color-by-theme"),
|
||||||
|
path: "background.color.by",
|
||||||
|
type: "radio",
|
||||||
|
func: function() {
|
||||||
|
render.dependents();
|
||||||
|
render.class();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
element: helper.e(".control-background-color-by-custom"),
|
||||||
|
path: "background.color.by",
|
||||||
|
type: "radio",
|
||||||
|
func: function() {
|
||||||
|
render.dependents();
|
||||||
|
render.class();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
element: helper.e(".control-background-color-custom-current"),
|
||||||
|
path: "background.color.custom",
|
||||||
|
type: "color",
|
||||||
|
func: function() {
|
||||||
|
background.render.color();
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
element: helper.e(".control-background-image-show"),
|
element: helper.e(".control-background-image-show"),
|
||||||
path: "background.image.show",
|
path: "background.image.show",
|
||||||
@ -2492,6 +2515,9 @@ var control = (function() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
var _background = function() {
|
var _background = function() {
|
||||||
|
helper.removeClass(html, "is-background-color-by-theme");
|
||||||
|
helper.removeClass(html, "is-background-color-by-custom");
|
||||||
|
helper.addClass(html, "is-background-color-by-" + state.get().background.color.by);
|
||||||
if (state.get().background.image.show) {
|
if (state.get().background.image.show) {
|
||||||
helper.addClass(html, "is-background-image-show");
|
helper.addClass(html, "is-background-image-show");
|
||||||
} else {
|
} else {
|
||||||
@ -3018,6 +3044,13 @@ var control = (function() {
|
|||||||
_disable.input(".control-background-image-url", true);
|
_disable.input(".control-background-image-url", true);
|
||||||
_disable.element(".control-background-image-url-helper", true);
|
_disable.element(".control-background-image-url-helper", true);
|
||||||
};
|
};
|
||||||
|
if (state.get().background.color.by == "theme") {
|
||||||
|
_disable.input(".control-background-color-custom-current", true);
|
||||||
|
_disable.element(".control-background-color-theme-helper", true);
|
||||||
|
} else if (state.get().background.color.by == "custom") {
|
||||||
|
_disable.input(".control-background-color-custom-current", false);
|
||||||
|
_disable.element(".control-background-color-theme-helper", false);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
_header();
|
_header();
|
||||||
_edit();
|
_edit();
|
||||||
|
@ -196,6 +196,14 @@ var state = (function() {
|
|||||||
radius: 0.2
|
radius: 0.2
|
||||||
},
|
},
|
||||||
background: {
|
background: {
|
||||||
|
color: {
|
||||||
|
by: "theme",
|
||||||
|
custom: {
|
||||||
|
r: 0,
|
||||||
|
g: 0,
|
||||||
|
b: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
image: {
|
image: {
|
||||||
show: false,
|
show: false,
|
||||||
from: "file",
|
from: "file",
|
||||||
|
@ -592,6 +592,17 @@ var update = (function() {
|
|||||||
"3.51.0": function(data) {
|
"3.51.0": function(data) {
|
||||||
data.state.link.add = false;
|
data.state.link.add = false;
|
||||||
return data;
|
return data;
|
||||||
|
},
|
||||||
|
"3.66.0": function(data) {
|
||||||
|
data.state.background.color = {
|
||||||
|
by: "theme",
|
||||||
|
custom: {
|
||||||
|
r: 0,
|
||||||
|
g: 0,
|
||||||
|
b: 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var version = (function() {
|
var version = (function() {
|
||||||
|
|
||||||
var current = "3.65.0";
|
var current = "3.66.0";
|
||||||
|
|
||||||
var compare = function(a, b) {
|
var compare = function(a, b) {
|
||||||
var pa = a.split(".");
|
var pa = a.split(".");
|
||||||
|
@ -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": "3.65.0",
|
"version": "3.66.0",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"chrome_url_overrides": {
|
"chrome_url_overrides": {
|
||||||
"newtab": "index.html"
|
"newtab": "index.html"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user