Fix generated palette code

- Only include my scales for custom palettes
- Do not include bogus role declarations
This commit is contained in:
Lea Verou
2025-03-17 11:15:03 -04:00
parent 2ac15dcda1
commit bfafc08761
2 changed files with 6 additions and 1 deletions

View File

@@ -51,6 +51,11 @@ export function getPaletteCode({ base, slug = base, colors, tweaked, roles, ...o
if (roles) {
for (let role in roles) {
let hue = roles[role];
if (!hue) {
continue;
}
for (let suffix of [...tints.map(t => '-' + t), '', '-key']) {
declarations.push(`--${prefix}-${role}${suffix}: var(--${prefix}-${hue}${suffix});`);
}

View File

@@ -409,7 +409,7 @@ let paletteAppSpec = {
let code = getPaletteCode({
base: this.paletteId,
slug: this.isCustom ? this.slug : undefined,
colors: this.colors,
colors: this.paletteScales,
tweaked: this.tweaked,
roles: this.isCustom ? this.computedRoles : this.roles,
language,