Fix color of cnamed entries in overview pane

Additionally, remove pointless (hsluv -> rgb -> hsluv) conversion
when computing accent color-based stylsheet.
This commit is contained in:
Raymond Hill 2022-02-03 07:12:15 -05:00
parent 7cec6d7b20
commit efec9aa69e
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 4 additions and 10 deletions

View File

@ -222,7 +222,7 @@
--accent-surface-1: rgb(var(--primary-40));
/* popup panel */
--popup-cell-cname-ink: rgb(var(--blue-50));
--popup-cell-cname-ink: #0054d7; /* h260 S:100 Luv:40 */;
--popup-cell-label-mixed-surface: #c29100; /* TODO: fix */
--popup-icon-x-ink: rgb(var(--red-60));
--popup-power-ink-rgb: var(--primary-50);
@ -299,7 +299,7 @@
--accent-surface-1: rgb(var(--primary-70));
/* popup panel */
--popup-cell-cname-ink: hsla(0, 0%, 53%, 0.3);
--popup-cell-cname-ink: #93a6ff; /* h260 S:100 Luv:70 */;
--popup-cell-label-mixed-surface: hsla(45, 100%, 38%, 1); /* TODO: fix */
--popup-icon-x-ink: rgb(var(--red-50));
--popup-power-ink-rgb: var(--primary-60);

View File

@ -104,19 +104,13 @@ DOMListFactory.setAccentColor = function(accentEnabled, accentColor, stylesheet
const hsl = self.hsluv.hexToHsluv(accentColor);
hsl[0] = Math.round(hsl[0] * 10) / 10;
hsl[1] = Math.round(Math.min(100, Math.max(0, hsl[1])));
hsl[2] = 70;
const rgb = self.hsluv.hsluvToRgb(hsl).map(
a => Math.round(a * 255).toString(16).padStart(2, '0')
);
// Use normalized result to derive all shades
const rgbNormal = `#${rgb.join('')}`;
const shades = [ 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95 ];
const text = [];
const hslNormal = self.hsluv.hexToHsluv(rgbNormal);
text.push(':root.accented {');
for ( const shade of shades ) {
hslNormal[2] = shade;
const rgb = self.hsluv.hsluvToRgb(hslNormal).map(a => Math.round(a * 255));
hsl[2] = shade;
const rgb = self.hsluv.hsluvToRgb(hsl).map(a => Math.round(a * 255));
text.push(` --primary-${shade}: ${rgb.join(' ')};`);
}
text.push('}', '');