Skip to content

Commit ee73519

Browse files
committed
[feature] add shade theme controls
1 parent 887ab26 commit ee73519

File tree

11 files changed

+184
-38
lines changed

11 files changed

+184
-38
lines changed

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nighttab",
3-
"version": "4.16.1",
3+
"version": "4.17.0",
44
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
55
"main": "index.js",
66
"scripts":{

‎src/css/shade.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.shade{
2-
background-color:rgba(var(--theme-accent),0.4);
2+
background-color:rgba(var(--theme-accent),var(--theme-shade-opacity));
33
position: fixed;
44
top:-1em;
55
left:-1em;

‎src/css/variables.css‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
0calc(var(--theme-shadow-size-large) *calc(calc(var(--theme-shadow-offset-y) *-1) *4)) calc(var(--theme-shadow-size-large) *calc(var(--theme-shadow-blur) *8)) rgba(0,0,0,calc(var(--theme-shadow-size-large) *calc(var(--theme-shadow-opacity) *2))),
7272
0calc(var(--theme-shadow-size-large) *calc(calc(var(--theme-shadow-offset-y) *-1) *8)) calc(var(--theme-shadow-size-large) *calc(var(--theme-shadow-blur) *16)) rgba(0,0,0,calc(var(--theme-shadow-size-large) *calc(var(--theme-shadow-opacity) *3))),
7373
0calc(var(--theme-shadow-size-large) *calc(calc(var(--theme-shadow-offset-y) *-1) *16)) calc(var(--theme-shadow-size-large) *calc(var(--theme-shadow-blur) *32)) rgba(0,0,0,calc(var(--theme-shadow-size-large) *calc(var(--theme-shadow-opacity) *4)));
74+
--theme-shade-opacity:0.4;
7475
/* header */
7576
--header-area-width:100%;
7677
--header-shade-color:var(--theme-color-01);

‎src/index.html‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,27 @@ <h1 class="menu-item-header-text">Shadow</h1>
18771877
</div>
18781878
</div>
18791879
<divclass="form-helper">
1880-
<pclass="control-theme-shadow-helper form-helper-item">Bookmarks and Modals will use the Large shadow.</p>
1880+
<pclass="control-theme-shadow-helper form-helper-item">Bookmarks and Modals use the Large shadow.</p>
1881+
</div>
1882+
</div>
1883+
</div>
1884+
<divclass="menu-item">
1885+
<divclass="menu-item-header">
1886+
<h1class="menu-item-header-text">Shade</h1>
1887+
</div>
1888+
<divclass="menu-item-form">
1889+
<divclass="form-wrap">
1890+
<labelfor="control-theme-shade-opacity">Opacity</label>
1891+
<divclass="form-group form-group-block">
1892+
<inputid="control-theme-shade-opacity" class="control-theme-shade-opacity mr-3" type="range" min="0" max="100" value="0" tabindex="-1">
1893+
<divclass="control-theme-shade-opacity-count form-group-text form-group-item-medium form-group-radius-left"></div>
1894+
</div>
1895+
</div>
1896+
<divclass="form-wrap">
1897+
<buttonclass="control-theme-shade-opacity-default button" tabindex="-1">Default opacity</button>
1898+
</div>
1899+
<divclass="form-helper">
1900+
<pclass="control-theme-shade-opacity-helper form-helper-item">The shade appears behind Modals and the Menu.</p>
18811901
</div>
18821902
</div>
18831903
</div>

‎src/js/control.js‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,6 +2984,28 @@ var control = (function(){
29842984
theme.render.shadow();
29852985
render.range.count(this);
29862986
}
2987+
},{
2988+
element: helper.e(".control-theme-shade-opacity"),
2989+
path: "theme.shade.opacity",
2990+
type: "range",
2991+
valueMod: ["reverse","float"],
2992+
rangeCountElement: helper.e(".control-theme-shade-opacity-count"),
2993+
func: function(){
2994+
theme.render.shade.opacity();
2995+
render.class();
2996+
render.range.count(this);
2997+
}
2998+
},{
2999+
element: helper.e(".control-theme-shade-opacity-default"),
3000+
type: "button",
3001+
func: function(){
3002+
mod.setValue("theme.shade.opacity",helper.getObject({
3003+
object: state.get.default(),
3004+
path: "theme.shade.opacity"
3005+
}));
3006+
theme.render.shade.opacity();
3007+
render.update();
3008+
}
29873009
},{
29883010
element: helper.e(".control-theme-shadow-default"),
29893011
type: "button",

‎src/js/state.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ var state = (function(){
262262
style: "dark",
263263
radius: 0.25,
264264
shadow: 1,
265+
shade: {
266+
opacity: 0.4
267+
},
265268
custom: {
266269
all: [],
267270
edit: false
@@ -402,7 +405,10 @@ var state = (function(){
402405
},
403406
style: "dark",
404407
radius: 0.25,
405-
shadow: 1
408+
shadow: 1,
409+
shade: {
410+
opacity: 0.4
411+
}
406412
}
407413
};
408414

0 commit comments

Comments
(0)