diff --git a/crates/forge-web/assets/nav.js b/crates/forge-web/assets/nav.js index 28e8e2d..0b30f22 100644 --- a/crates/forge-web/assets/nav.js +++ b/crates/forge-web/assets/nav.js @@ -920,8 +920,11 @@ } // The chroma a row's vividness stands for: the background's is small, as the stylesheet draws it. - function rowChroma(kind, vivid) { - return kind === 'base' ? 0.0004 * vivid : 0.03 + 0.16 * vivid / 100; + // The light panel's accent chroma is the server's 12/11 of the dark one (its base chroma is 0.12, not 0.11). + function rowChroma(row, vivid) { + if (row.getAttribute('data-kind') === 'base') { return 0.0004 * vivid; } + var c = 0.03 + 0.16 * vivid / 100; + return row.closest('[data-colour-panel="light"]') ? c * 12 / 11 : c; } function rowHue(row) { return parseInt(row.querySelector('input[data-hue-stripe]').value, 10) || 0; } @@ -942,7 +945,7 @@ row.style.setProperty('--v', String(vivid / 100)); if (custom) { custom.value = 'hue-' + hue + '-v' + vivid; } if (fillHex && hex) { - hex.value = hexOfOklch(parseFloat(row.getAttribute('data-lightness')), rowChroma(row.getAttribute('data-kind'), vivid), hue); + hex.value = hexOfOklch(parseFloat(row.getAttribute('data-lightness')), rowChroma(row, vivid), hue); hex.removeAttribute('aria-invalid'); } } @@ -981,7 +984,8 @@ var lch = oklchOfHex(match[1]); var kind = row.getAttribute('data-kind'); var hue = Math.round(lch.h) % 360; - var vivid = kind === 'base' ? Math.round(lch.c / 0.0004) : Math.round((lch.c - 0.03) / 0.16 * 100); + var accentC = kind !== 'base' && row.closest('[data-colour-panel="light"]') ? lch.c * 11 / 12 : lch.c; + var vivid = kind === 'base' ? Math.round(lch.c / 0.0004) : Math.round((accentC - 0.03) / 0.16 * 100); vivid = clamp(vivid, 0, 100); var note = row.querySelector('[data-hex-note]'); if (note) { diff --git a/crates/forge-web/src/pages/settings_appearance.rs b/crates/forge-web/src/pages/settings_appearance.rs index 9466c11..21bb293 100644 --- a/crates/forge-web/src/pages/settings_appearance.rs +++ b/crates/forge-web/src/pages/settings_appearance.rs @@ -107,8 +107,10 @@ fn picker_hex(hue: u16, vivid: u8, base: bool, dark: bool) -> String { let v = f64::from(vivid); let chroma = if base { 0.0004 * v - } else { + } else if dark { 0.03 + 0.16 * v / 100.0 + } else { + 12.0 / 11.0 * (0.03 + 0.16 * v / 100.0) }; custom_colour::colour(row_lightness(base, dark), chroma, f64::from(hue)) } diff --git a/style/main.scss b/style/main.scss index 515e96b..8812b17 100644 --- a/style/main.scss +++ b/style/main.scss @@ -2526,6 +2526,8 @@ code { [data-colour-panel="light"] [data-colour-row][data-kind="accent"] { --track-l: 0.52; + --c-min: calc(0.03 * 12 / 11); + --c-span: calc(0.16 * 12 / 11); } .hue-row {