diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 5026888a..76839833 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -2148,6 +2148,9 @@ html.y #tree.nowrap .ntree a+a:hover { #rui td input[type="text"] { width: 100%; } +input[type="text"].invalid { + border-color: var(--err-b1); +} #rui #rn_n_d, #rui #rn_n_s, #shui td.exs input[type="text"] { diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 484977fc..6c3e5fed 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -1275,18 +1275,27 @@ ebi('op_cfg').innerHTML = ( })(); // accent color +function parseColor (strColor) { + const s = new Option().style; + s.color = strColor; + return s.color !== '' ? s.color : ''; +} + ebi('accent').oninput = function () { - if(this.value == accent) + var validcolor = parseColor(this.value); + clmod(ebi('accent'), 'invalid', this.value.length != 0 && validcolor.length == 0); + if(validcolor == accent) return; - accent = this.value; + accent = validcolor; swrite('accent', accent); var a = accent || '#fc0'; console.log('accent color set to: ' + a); document.documentElement.style.setProperty('--a', a); } -var accent = ebi('accent').value = sread('accent') || ''; -if(accent) - document.documentElement.style.setProperty('--a', accent); +var accent = ebi('accent').value = sread('accent'); +if(accent){ + document.documentElement.style.setProperty('--a', parseColor(accent)); +} // navpane ebi('tree').innerHTML = (