mirror of https://github.com/gorhill/uBlock.git
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:
parent
7cec6d7b20
commit
efec9aa69e
|
@ -222,7 +222,7 @@
|
||||||
--accent-surface-1: rgb(var(--primary-40));
|
--accent-surface-1: rgb(var(--primary-40));
|
||||||
|
|
||||||
/* popup panel */
|
/* 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-cell-label-mixed-surface: #c29100; /* TODO: fix */
|
||||||
--popup-icon-x-ink: rgb(var(--red-60));
|
--popup-icon-x-ink: rgb(var(--red-60));
|
||||||
--popup-power-ink-rgb: var(--primary-50);
|
--popup-power-ink-rgb: var(--primary-50);
|
||||||
|
@ -299,7 +299,7 @@
|
||||||
--accent-surface-1: rgb(var(--primary-70));
|
--accent-surface-1: rgb(var(--primary-70));
|
||||||
|
|
||||||
/* popup panel */
|
/* 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-cell-label-mixed-surface: hsla(45, 100%, 38%, 1); /* TODO: fix */
|
||||||
--popup-icon-x-ink: rgb(var(--red-50));
|
--popup-icon-x-ink: rgb(var(--red-50));
|
||||||
--popup-power-ink-rgb: var(--primary-60);
|
--popup-power-ink-rgb: var(--primary-60);
|
||||||
|
|
|
@ -104,19 +104,13 @@ DOMListFactory.setAccentColor = function(accentEnabled, accentColor, stylesheet
|
||||||
const hsl = self.hsluv.hexToHsluv(accentColor);
|
const hsl = self.hsluv.hexToHsluv(accentColor);
|
||||||
hsl[0] = Math.round(hsl[0] * 10) / 10;
|
hsl[0] = Math.round(hsl[0] * 10) / 10;
|
||||||
hsl[1] = Math.round(Math.min(100, Math.max(0, hsl[1])));
|
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
|
// 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 shades = [ 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95 ];
|
||||||
const text = [];
|
const text = [];
|
||||||
const hslNormal = self.hsluv.hexToHsluv(rgbNormal);
|
|
||||||
text.push(':root.accented {');
|
text.push(':root.accented {');
|
||||||
for ( const shade of shades ) {
|
for ( const shade of shades ) {
|
||||||
hslNormal[2] = shade;
|
hsl[2] = shade;
|
||||||
const rgb = self.hsluv.hsluvToRgb(hslNormal).map(a => Math.round(a * 255));
|
const rgb = self.hsluv.hsluvToRgb(hsl).map(a => Math.round(a * 255));
|
||||||
text.push(` --primary-${shade}: ${rgb.join(' ')};`);
|
text.push(` --primary-${shade}: ${rgb.join(' ')};`);
|
||||||
}
|
}
|
||||||
text.push('}', '');
|
text.push('}', '');
|
||||||
|
|
Loading…
Reference in New Issue