Skip to content

Commit bd9b96f

Browse files
committed
[feature] add header background colour controls
1 parent 30815c1 commit bd9b96f

File tree

13 files changed

+245
-129
lines changed

13 files changed

+245
-129
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.22.0",
3+
"version": "4.23.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/header.css‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
pointer-events: none;
77
}
88

9-
.is-header-shade-show .header{
9+
.is-header-color-show .header{
1010
pointer-events: all;
1111
}
1212

@@ -40,7 +40,7 @@
4040
bottom:0;
4141
}
4242

43-
.header-shade{
43+
.header-color{
4444
background-color: transparent;
4545
content:"";
4646
width:100%;
@@ -53,18 +53,24 @@
5353
transition: background-color var(--layout-timing-medium), opacity var(--layout-timing-medium), border-radius var(--layout-timing-extra-fast);
5454
}
5555

56-
.is-header-radius .header-shade{
56+
.is-header-radius .header-color{
5757
border-radius:calc(var(--theme-radius) *4);
5858
}
5959

60-
.is-background-color-by-theme.is-header-shade-style-always .header-shade,
61-
.is-background-color-by-theme.is-header-shade-style-scroll .header-shade{
62-
background-color:rgba(var(--header-shade-color),var(--header-shade-opacity));
60+
.is-header-color-by-theme.is-header-color-style-always .header-color{
61+
background-color:rgba(var(--header-color-theme),var(--header-opacity));
6362
}
6463

65-
.is-background-color-by-custom.is-header-shade-style-always .header-shade,
66-
.is-background-color-by-custom.is-header-shade-style-scroll .header-shade{
67-
background-color:rgba(var(--background-color-custom),var(--header-shade-opacity));
64+
.is-header-color-by-theme.is-header-color-style-scroll.is-header-color-style-scrolling .header-color{
65+
background-color:rgba(var(--header-color-theme),var(--header-opacity));
66+
}
67+
68+
.is-header-color-by-custom.is-header-color-style-always .header-color{
69+
background-color:rgba(var(--header-color-custom),var(--header-opacity));
70+
}
71+
72+
.is-header-color-by-custom.is-header-color-style-scroll.is-header-color-style-scrolling .header-color{
73+
background-color:rgba(var(--header-color-custom),var(--header-opacity));
6874
}
6975

7076
.header-area{
@@ -100,7 +106,7 @@
100106
border-bottom:calc(var(--layout-line-width) *var(--header-border-bottom)) solid rgb(var(--theme-accent));
101107
}
102108

103-
.is-header-radius .header-shade{
109+
.is-header-radius .header-color{
104110
border-radius:calc(var(--theme-radius) *4);
105111
}
106112

‎src/css/link.css‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
}
3131

3232
.is-layout-order-headerlink.is-header-border-bottom .link,
33-
.is-layout-order-headerlink.is-header-shade-style-always .link{
33+
.is-layout-order-headerlink.is-header-color-style-always .link{
3434
margin-top:0;
3535
}
3636

3737
.is-layout-order-linkheader.is-header-border-top .link,
38-
.is-layout-order-linkheader.is-header-shade-style-always .link{
38+
.is-layout-order-linkheader.is-header-color-style-always .link{
3939
margin-bottom:0;
4040
}
4141

‎src/css/variables.css‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@
7474
--theme-shade-opacity:0.4;
7575
/* header */
7676
--header-area-width:100%;
77-
--header-shade-color:var(--theme-color-01);
78-
--header-shade-opacity:0.95;
77+
--header-color-theme:var(--theme-color-01);
78+
--header-color-custom:rgb(0,0,0);
79+
--header-opacity:0.95;
7980
--header-search-width:0%;
8081
--header-border-top:0;
8182
--header-border-bottom:0;

‎src/index.html‎

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<mainclass="layout">
5151

5252
<headerclass="header">
53-
<divclass="header-shade"></div>
53+
<divclass="header-color"></div>
5454
<divclass="header-border"></div>
5555
<divclass="header-area">
5656
<divclass="header-item-grid">
@@ -925,36 +925,61 @@ <h1 class="menu-item-header-text">Position when scrolling</h1>
925925
</div>
926926
<divclass="menu-item">
927927
<divclass="menu-item-header">
928-
<h1class="menu-item-header-text">Shade</h1>
928+
<h1class="menu-item-header-text">Background colour</h1>
929929
</div>
930930
<divclass="menu-item-form">
931931
<divclass="form-wrap">
932-
<inputid="control-header-shade-show" class="control-header-shade-show" type="checkbox" tabindex="-1">
933-
<labelfor="control-header-shade-show"><spanclass="label-icon"></span> Show</label>
932+
<inputid="control-header-color-show" class="control-header-color-show" type="checkbox" tabindex="-1">
933+
<labelfor="control-header-color-show"><spanclass="label-icon"></span> Show</label>
934934
</div>
935935
<divclass="form-wrap">
936936
<divclass="form-indent">
937937
<divclass="form-wrap">
938-
<inputid="control-header-shade-style-always" class="control-header-shade-style-always" type="radio" name="control-header-shade-style" value="always" tabindex="-1">
939-
<labelfor="control-header-shade-style-always"><spanclass="label-icon"></span> Always visible</label>
938+
<inputid="control-header-color-style-always" class="control-header-color-style-always" type="radio" name="control-header-color-style" value="always" tabindex="-1">
939+
<labelfor="control-header-color-style-always"><spanclass="label-icon"></span> Always visible</label>
940+
</div>
941+
<divclass="form-helper">
942+
<pclass="control-header-color-style-always-helper form-helper-item">Useful for when a Background Image is shown.</p>
943+
</div>
944+
<divclass="form-wrap">
945+
<inputid="control-header-color-style-scroll" class="control-header-color-style-scroll" type="radio" name="control-header-color-style" value="scroll" tabindex="-1">
946+
<labelfor="control-header-color-style-scroll"><spanclass="label-icon"></span> Visible on scroll</label>
940947
</div>
941948
<divclass="form-helper">
942-
<pclass="control-header-shade-style-always-helper form-helper-item">Useful for when a Background Image is shown.</p>
949+
<pclass="control-header-color-style-scroll-helper form-helper-item">The page will not scroll if Bookmarks are not shown.</p>
943950
</div>
951+
<hr>
944952
<divclass="form-wrap">
945-
<inputid="control-header-shade-style-scroll" class="control-header-shade-style-scroll" type="radio" name="control-header-shade-style" value="scroll" tabindex="-1">
946-
<labelfor="control-header-shade-style-scroll"><spanclass="label-icon"></span>Visible on scroll</label>
953+
<inputid="control-header-color-by-theme" class="control-header-color-by-theme" type="radio" name="control-header-color-by" value="theme" tabindex="-1">
954+
<labelfor="control-header-color-by-theme"><spanclass="label-icon"></span>Theme colour</label>
947955
</div>
948956
<divclass="form-helper">
949-
<pclass="control-header-shade-style-scroll-helper form-helper-item">The page will not scroll if Bookmarks are not shown.</p>
957+
<pclass="control-header-color-by-theme-helper form-helper-item">Use the Background colour defined by the Theme.</p>
958+
</div>
959+
<divclass="form-wrap">
960+
<inputid="control-header-color-by-custom" class="control-header-color-by-custom" type="radio" name="control-header-color-by" value="custom" tabindex="-1">
961+
<labelfor="control-header-color-by-custom"><spanclass="label-icon"></span> Custom colour</label>
962+
</div>
963+
<divclass="form-helper">
964+
<pclass="control-header-color-by-custom-helper form-helper-item">Use a custom Background colour.</p>
965+
</div>
966+
<divclass="form-wrap">
967+
<divclass="form-indent">
968+
<divclass="form-wrap">
969+
<divclass="form-group form-group-block">
970+
<inputid="control-header-color-rgb-picker" class="form-group-item-half control-header-color-rgb-picker" type="color" value="#000000" tabindex="1">
971+
<inputid="control-header-color-rgb-hex" class="form-group-item-half control-header-color-rgb-hex" type="text" placeholder="Hex code" value="#000000" tabindex="1" maxlength="7" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
972+
</div>
973+
</div>
974+
</div>
950975
</div>
951976
<hr>
952977
<divclass="form-wrap">
953-
<labelfor="control-header-shade-opacity">Opacity</label>
978+
<labelfor="control-header-color-opacity">Opacity</label>
954979
<divclass="form-group form-group-block">
955-
<inputid="control-header-shade-opacity" class="control-header-shade-opacity mr-3" type="range" min="0" max="100" value="0" tabindex="-1">
956-
<divclass="control-header-shade-opacity-count form-group-text form-group-item-medium form-group-radius-left"></div>
957-
<buttonclass="control-header-shade-opacity-default button" tabindex="-1" title="Reset to default"><spanclass="icon-undo"></span></button>
980+
<inputid="control-header-color-opacity" class="control-header-color-opacity mr-3" type="range" min="0" max="100" value="0" tabindex="-1">
981+
<divclass="control-header-color-opacity-count form-group-text form-group-item-medium form-group-radius-left"></div>
982+
<buttonclass="control-header-color-opacity-default button" tabindex="-1" title="Reset to default"><spanclass="icon-undo"></span></button>
958983
</div>
959984
</div>
960985
<hr>
@@ -1871,8 +1896,8 @@ <h1 class="menu-item-header-text">Colour</h1>
18711896
<divclass="form-indent">
18721897
<divclass="form-wrap">
18731898
<divclass="form-group form-group-block">
1874-
<inputid="control-background-color-picker" class="form-group-item-half control-background-color-picker" type="color" value="#000000" tabindex="1">
1875-
<inputid="control-background-color-hex" class="form-group-item-half control-background-color-hex" type="text" placeholder="Hex code" value="#000000" tabindex="1" maxlength="7" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
1899+
<inputid="control-background-color-rgb-picker" class="form-group-item-half control-background-color-rgb-picker" type="color" value="#000000" tabindex="1">
1900+
<inputid="control-background-color-rgb-hex" class="form-group-item-half control-background-color-rgb-hex" type="text" placeholder="Hex code" value="#000000" tabindex="1" maxlength="7" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
18761901
</div>
18771902
</div>
18781903
</div>

‎src/js/background.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ var background = (function(){
127127
helper.e(".control-background-image-file").value="";
128128
},
129129
picker: function(){
130-
helper.e(".control-background-color-picker").value=helper.convertColor.rgb.hex(state.get.current().background.color.rgb);
130+
helper.e(".control-background-color-rgb-picker").value=helper.convertColor.rgb.hex(state.get.current().background.color.rgb);
131131
},
132132
hex: function(){
133-
helper.e(".control-background-color-hex").value=helper.convertColor.rgb.hex(state.get.current().background.color.rgb);
133+
helper.e(".control-background-color-rgb-hex").value=helper.convertColor.rgb.hex(state.get.current().background.color.rgb);
134134
}
135135
};
136136

0 commit comments

Comments
(0)