diff --git a/configurator/src/components/DomainPanel.svelte b/configurator/src/components/DomainPanel.svelte index e4fdbc0a..e41f0518 100644 --- a/configurator/src/components/DomainPanel.svelte +++ b/configurator/src/components/DomainPanel.svelte @@ -220,7 +220,7 @@ /> {/if} - {#if smartSections.length} + {#if smartSections.length && domain.id !== 'colors' && domain.id !== 'gradients'} {/if} diff --git a/configurator/src/components/ShadeRamp.svelte b/configurator/src/components/ShadeRamp.svelte index 08d56c85..5b91531c 100644 --- a/configurator/src/components/ShadeRamp.svelte +++ b/configurator/src/components/ShadeRamp.svelte @@ -15,7 +15,10 @@ import { BRAND_COLOR_KEYS } from '../lib/brandColors.js'; import { parseRgb } from '../lib/contrast.js'; + let { colorKey = null, showIntro = true } = $props(); + const BRAND_KEYS = BRAND_COLOR_KEYS.filter((k) => k.group === 'brand'); + const visibleBrandKeys = $derived(colorKey ? BRAND_KEYS.filter((k) => k.key === colorKey) : BRAND_KEYS); const SHADE_STEPS = [ { suffix: '-superlight', label: 'superlight' }, @@ -27,9 +30,9 @@ { suffix: '-superdark', label: 'superdark' }, ]; - const ALL_SHADE_TOKENS = BRAND_KEYS.flatMap(({ key }) => + const ALL_SHADE_TOKENS = $derived(visibleBrandKeys.flatMap(({ key }) => SHADE_STEPS.map(({ suffix }) => `--sf-color-${key}${suffix}`) - ); + )); /** @type {Record} token → resolved rgb() string */ let resolved = $state({}); @@ -58,14 +61,27 @@ if (!c) return 128; return (c.r * 0.299 + c.g * 0.587 + c.b * 0.114) * 255; } + + function shadeMetrics(rgb) { + const c = parseRgb(rgb); + if (!c) return { lightness: '…', chroma: '…' }; + const max = Math.max(c.r, c.g, c.b); + const min = Math.min(c.r, c.g, c.b); + return { + lightness: `${Math.round(perceived(rgb) / 2.55)}%`, + chroma: (max - min).toFixed(3), + }; + }
-

- 7-step ramp for each brand color, resolved against the {ui.previewTheme} theme. -

+ {#if showIntro} +

+ 7-step ramp for each brand color, resolved against the {ui.previewTheme} theme. +

+ {/if} - {#each BRAND_KEYS as { key, label } (key)} + {#each visibleBrandKeys as { key, label } (key)}
{label}
@@ -90,12 +106,24 @@
{/each}
+ + + + {#each SHADE_STEPS as { suffix, label: stepLabel } (`table-${key}${suffix}`)} + {@const token = `--sf-color-${key}${suffix}`} + {@const metrics = shadeMetrics(resolved[token])} + + {/each} + +
ShadeLightnessChroma
{stepLabel}{metrics.lightness}{metrics.chroma}
{/each} + {#if showIntro}

Toggle in the preview pane to compare modes.

+ {/if}