Skip to content

Commit f3695f3

Browse files
committed
[feature] allow hex value for accent colour
1 parent d9c6618 commit f3695f3

File tree

7 files changed

+90
-34
lines changed

7 files changed

+90
-34
lines changed

‎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": "3.74.2",
3+
"version": "3.75.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/index.html‎

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
</div>
8787
<divclass="header-item header-button header-accent">
8888
<divclass="input-wrap input-button input-color-dot input-color-dot-accent py-0">
89-
<inputid="control-theme-accent-current" class="control-theme-accent-current" type="color" tabindex="1">
90-
<labelfor="control-theme-accent-current">Accent</label>
89+
<inputid="control-theme-accent-current-quick" class="control-theme-accent-current-quick" type="color" tabindex="1">
90+
<labelfor="control-theme-accent-current-quick">Accent</label>
9191
</div>
9292
</div>
9393
<divclass="header-item header-button header-menu">
@@ -105,7 +105,6 @@
105105

106106
</main>
107107

108-
109108
<sectionclass="menu" tabindex="-1">
110109
<divclass="menu-area">
111110

@@ -967,33 +966,17 @@ <h1 class="menu-item-header-text">Accent override</h1>
967966
<divclass="menu-content-area menu-content-area-theme is-hidden">
968967
<divclass="menu-item">
969968
<divclass="menu-item-header">
970-
<h1class="menu-item-header-text">Style</h1>
969+
<h1class="menu-item-header-text">Accent</h1>
971970
</div>
972971
<divclass="menu-item-form">
973-
<divclass="input-wrap">
974-
<inputid="control-theme-style-dark" class="control-theme-style-dark" type="radio" name="control-theme-style" value="dark" tabindex="-1">
975-
<labelfor="control-theme-style-dark">Dark</label>
976-
</div>
977-
<divclass="input-wrap">
978-
<inputid="control-theme-style-light" class="control-theme-style-light" type="radio" name="control-theme-style" value="light" tabindex="-1">
979-
<labelfor="control-theme-style-light">Light</label>
972+
<labelfor="control-theme-accent-current-picker">Colour</label>
973+
<divclass="input-wrap"><divclass="form-group mb-0">
974+
<inputid="control-theme-accent-current-picker" class="form-group-item-half control-theme-accent-current-picker mb-0" type="color" value="#000000" tabindex="1">
975+
<inputid="control-theme-accent-current-hex" class="form-group-item-half control-theme-accent-current-hex mb-0" type="text" placeholder="Hex code" value="#000000" tabindex="1" maxlength="7">
976+
</div>
980977
</div>
981-
<pclass="control-theme-style-light-helper form-helper small">Accent Colour and Background Image may need to be changed to best fit the Theme Style.</p>
978+
<pclass="control-theme-style-light-helper form-helper small">Accent Colour can also be changed from the Header area.</p>
982979
<hr>
983-
<divclass="input-wrap">
984-
<labelfor="control-theme-radius">Radius</label>
985-
<inputid="control-theme-radius" class="control-theme-radius" type="range" min="0" max="300" value="0" step="20" tabindex="-1">
986-
</div>
987-
<divclass="button-wrap">
988-
<buttonclass="control-theme-radius-default button mb-0" tabindex="-1">Default radius</button>
989-
</div>
990-
</div>
991-
</div>
992-
<divclass="menu-item">
993-
<divclass="menu-item-header">
994-
<h1class="menu-item-header-text">Accent</h1>
995-
</div>
996-
<divclass="menu-item-form">
997980
<divclass="input-wrap">
998981
<inputid="control-theme-accent-random-active" class="control-theme-accent-random-active" type="checkbox" tabindex="-1">
999982
<labelfor="control-theme-accent-random-active">Random Accent colour on load/refresh</label>
@@ -1025,6 +1008,30 @@ <h1 class="menu-item-header-text">Accent</h1>
10251008
</div>
10261009
</div>
10271010
</div>
1011+
<divclass="menu-item">
1012+
<divclass="menu-item-header">
1013+
<h1class="menu-item-header-text">Style</h1>
1014+
</div>
1015+
<divclass="menu-item-form">
1016+
<divclass="input-wrap">
1017+
<inputid="control-theme-style-dark" class="control-theme-style-dark" type="radio" name="control-theme-style" value="dark" tabindex="-1">
1018+
<labelfor="control-theme-style-dark">Dark</label>
1019+
</div>
1020+
<divclass="input-wrap">
1021+
<inputid="control-theme-style-light" class="control-theme-style-light" type="radio" name="control-theme-style" value="light" tabindex="-1">
1022+
<labelfor="control-theme-style-light">Light</label>
1023+
</div>
1024+
<pclass="control-theme-style-light-helper form-helper small">Accent Colour and Background Image may need to be changed to best fit the Theme Style.</p>
1025+
<hr>
1026+
<divclass="input-wrap">
1027+
<labelfor="control-theme-radius">Radius</label>
1028+
<inputid="control-theme-radius" class="control-theme-radius" type="range" min="0" max="300" value="0" step="20" tabindex="-1">
1029+
</div>
1030+
<divclass="button-wrap">
1031+
<buttonclass="control-theme-radius-default button mb-0" tabindex="-1">Default radius</button>
1032+
</div>
1033+
</div>
1034+
</div>
10281035
</div>
10291036

10301037
<divclass="menu-content-area menu-content-area-background is-hidden">

‎src/js/control.js‎

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ var control = (function(){
6969
render.class();
7070
}
7171
},{
72-
element: helper.e(".control-theme-accent-current"),
72+
element: helper.e(".control-theme-accent-current-quick"),
7373
path: "theme.accent.current",
7474
type: "color",
7575
func: function(){
7676
theme.accent();
77+
theme.render.input.picker();
78+
theme.render.input.hex();
7779
link.items();
7880
}
7981
},{
@@ -2016,6 +2018,27 @@ var control = (function(){
20162018
link.mod.accent.rainbow();
20172019
link.items();
20182020
}
2021+
},{
2022+
element: helper.e(".control-theme-accent-current-picker"),
2023+
path: "theme.accent.current",
2024+
type: "color",
2025+
func: function(){
2026+
theme.accent();
2027+
theme.render.input.quick();
2028+
theme.render.input.hex();
2029+
link.items();
2030+
}
2031+
},{
2032+
element: helper.e(".control-theme-accent-current-hex"),
2033+
path: "theme.accent.current",
2034+
type: "text",
2035+
valueMod: ["hexTextString"],
2036+
func: function(){
2037+
theme.accent();
2038+
theme.render.input.picker();
2039+
theme.render.input.quick();
2040+
link.items();
2041+
}
20192042
},{
20202043
element: helper.e(".control-theme-style-dark"),
20212044
path: "theme.style",
@@ -2280,6 +2303,9 @@ var control = (function(){
22802303
},
22812304
float: function(value,object){
22822305
returnvalue/100;
2306+
},
2307+
hexTextString: function(value,object){
2308+
returnhelper.hexToRgb(value);
22832309
}
22842310
};
22852311
varchangeValue=function(object){
@@ -3066,6 +3092,9 @@ var control = (function(){
30663092
},
30673093
float: function(value,element){
30683094
returnvalue*100;
3095+
},
3096+
hexTextString: function(value,element){
3097+
returnhelper.rgbToHex(value);
30693098
}
30703099
};
30713100
varsetValue={
@@ -3082,10 +3111,16 @@ var control = (function(){
30823111
})).checked=true;
30833112
},
30843113
text: function(object){
3085-
object.element.value=helper.getObject({
3114+
varnewValue=helper.getObject({
30863115
object: state.get(),
30873116
path: object.path
30883117
});
3118+
if(object.valueMod){
3119+
object.valueMod.slice().reverse().forEach(function(arrayItem,index){
3120+
newValue=valueMod[arrayItem](newValue,object.element);
3121+
});
3122+
};
3123+
object.element.value=newValue;
30893124
},
30903125
number: function(object){
30913126
object.element.value=helper.getObject({

‎src/js/header.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ var header = (function(){
135135
varaction={
136136
box: function(){
137137
helper.removeClass(helper.getClosest(helper.e(".control-link-edit"),".input-wrap"),"input-button-link");
138-
helper.removeClass(helper.getClosest(helper.e(".control-theme-accent-current"),".input-wrap"),"input-button-link");
138+
helper.removeClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"),".input-wrap"),"input-button-link");
139139
helper.removeClass(helper.e(".control-link-add"),"button-link");
140140
helper.removeClass(helper.e(".control-menu-open"),"button-link");
141141
},
142142
clear: function(){
143143
helper.addClass(helper.getClosest(helper.e(".control-link-edit"),".input-wrap"),"input-button-link");
144-
helper.addClass(helper.getClosest(helper.e(".control-theme-accent-current"),".input-wrap"),"input-button-link");
144+
helper.addClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"),".input-wrap"),"input-button-link");
145145
helper.addClass(helper.e(".control-link-add"),"button-link");
146146
helper.addClass(helper.e(".control-menu-open"),"button-link");
147147
}

‎src/js/theme.js‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,25 @@ var theme = (function(){
9999
path: "theme.accent.current",
100100
newValue: randomColor
101101
});
102-
helper.e(".control-theme-accent-current").value=helper.rgbToHex(randomColor);
102+
helper.e(".control-theme-accent-current-quick").value=helper.rgbToHex(randomColor);
103+
helper.e(".control-theme-accent-current-picker").value=helper.rgbToHex(randomColor);
104+
helper.e(".control-theme-accent-current-hex").value=helper.rgbToHex(randomColor);
103105
};
104106
}
105107
};
106108

109+
render.input={
110+
quick: function(){
111+
helper.e(".control-theme-accent-current-quick").value=helper.rgbToHex(state.get().theme.accent.current);
112+
},
113+
picker: function(){
114+
helper.e(".control-theme-accent-current-picker").value=helper.rgbToHex(state.get().theme.accent.current);
115+
},
116+
hex: function(){
117+
helper.e(".control-theme-accent-current-hex").value=helper.rgbToHex(state.get().theme.accent.current);
118+
}
119+
};
120+
107121
vartoggle=function(){
108122
mod.theme.toggle();
109123
render.theme();

‎src/js/version.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
varversion=(function(){
22

3-
varcurrent="3.74.2";
3+
varcurrent="3.75.0";
44

55
varcompare=function(a,b){
66
varpa=a.split(".");

‎src/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nightTab",
33
"short_name": "nightTab",
44
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
5-
"version": "3.74.2",
5+
"version": "3.75.0",
66
"manifest_version": 2,
77
"chrome_url_overrides":{
88
"newtab": "index.html"

0 commit comments

Comments
(0)