fix tcolor link to accent color

This commit is contained in:
Til Schmitter 2026-06-20 20:29:01 +02:00
parent 04151dc7c9
commit 37f393d8e4
3 changed files with 29 additions and 24 deletions

View file

@ -296,7 +296,6 @@
CGV = {{ cgv|tojson }}, CGV = {{ cgv|tojson }},
TS = "{{ ts }}", TS = "{{ ts }}",
dtheme = "{{ dtheme }}", dtheme = "{{ dtheme }}",
tcolor = "#{{ tcolor }}"
lang = "{{ lang }}", lang = "{{ lang }}",
dfavico = "{{ favico }}", dfavico = "{{ favico }}",
have_tags_idx = {{ have_tags_idx }}, have_tags_idx = {{ have_tags_idx }},

View file

@ -1480,21 +1480,6 @@ if(sread('cfg_lgcy') == 'true')
ebi('reloc_cfg').click(); ebi('reloc_cfg').click();
// accent color // accent color
function parseColor (strColor) {
var s = new Option().style;
s.color = strColor;
return s.color !== '' ? s.color : '';
}
function setColor (color) {
accent = color;
swrite('accent', accent);
var a = accent || '';
console.log('accent color set to: ' + a);
document.documentElement.style.setProperty('--a', a);
pbar.drawbuf();
pbar.drawpos();
vbar.draw();
}
ebi('accent').oninput = ebi('accent_picker').oninput = function () { ebi('accent').oninput = ebi('accent_picker').oninput = function () {
var validcolor = parseColor(this.value); var validcolor = parseColor(this.value);
console.log(this.value); console.log(this.value);
@ -1516,14 +1501,6 @@ ebi('accent').oninput = ebi('accent_picker').oninput = function () {
setColor(validcolor); setColor(validcolor);
}, 100); }, 100);
} }
var accent = sread('accent');
if(!accent || accent.length <= 3)
accent = window.tcolor;
if(accent && accent.length > 3){
console.log('read accent color from settings: ' + accent);
document.documentElement.style.setProperty('--a', parseColor(accent));
ebi('accent').value = ebi('accent_picker').value = accent;
}
// corner radius // corner radius
ebi('radius').oninput = function () { ebi('radius').oninput = function () {

View file

@ -2346,6 +2346,35 @@ function cprop(name) {
return getComputedStyle(document.documentElement).getPropertyValue(name); return getComputedStyle(document.documentElement).getPropertyValue(name);
} }
// read accent / theme color
function parseColor (strColor) {
var s = new Option().style;
s.color = strColor;
return s.color !== '' ? s.color : '';
}
function setColor (color) {
accent = color;
swrite('accent', accent);
var a = accent || '';
console.log('accent color set to: ' + a);
document.documentElement.style.setProperty('--a', a);
pbar.drawbuf();
pbar.drawpos();
vbar.draw();
}
var accent = sread('accent');
var tcolor = QS('meta[name=theme-color]');
if(tcolor)
tcolor = tcolor.content;
if((!accent || accent.length <= 3) && tcolor != "#333333")
accent = tcolor;
var thing = QS('meta[name=theme-color]');
if(accent && accent.length > 3){
console.log('read accent color from settings: ' + accent);
document.documentElement.style.setProperty('--a', parseColor(accent));
if(ebi('accent'))
ebi('accent').value = ebi('accent_picker').value = accent;
}
function bchrome() { function bchrome() {
var v, o = QS('meta[name=theme-color]'); var v, o = QS('meta[name=theme-color]');