Skip to content

Comments

feat(tasty): add glaze theming#1035

Open
tenphi wants to merge 2 commits intomainfrom
feat-flaze
Open

feat(tasty): add glaze theming#1035
tenphi wants to merge 2 commits intomainfrom
feat-flaze

Conversation

@tenphi
Copy link
Member

@tenphi tenphi commented Feb 16, 2026

Note

Medium Risk
Introduces a sizable new color-generation surface area with non-trivial contrast/math algorithms and new package exports, which could affect consumers via API usage and bundling/typing entrypoints despite being additive.

Overview
Adds new glaze theming API to generate OKHSL-based light/dark/high-contrast palettes from seed hue/saturation, including dependent colors with explicit minContrast (WCAG AA/AAA presets or numeric) enforcement.

Introduces a contrast solver (with caching) and OKHSL color-math utilities, plus a theme/palette API supporting .colors(), .extend(), .resolve(), and exports to tasty token maps/JSON with configurable state aliases and per-call/global output modes.

Exposes the new entrypoint via src/tasty/index.ts and a tree-shakeable @cube-dev/ui-kit/tasty/glaze export (package exports), with comprehensive unit tests and a changeset for a minor version bump.

Written by Cursor Bugbot for commit e069ede. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Feb 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cube-ui-kit Ready Ready Preview, Comment Feb 17, 2026 2:08pm
cube-ui-kit-cursor Ready Ready Preview, Comment Feb 17, 2026 2:08pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 16, 2026

🦋 Changeset detected

Latest commit: e069ede

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cube-dev/ui-kit Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

📦 NPM canary release

Deployed canary version 0.0.0-canary-e2a9f35.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

🧪 Storybook is successfully deployed!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

🏋️ Size limit report

Name Size Passed?
All 364.9 KB (+1.32% 🔺) Yes 🎉
Tree shaking (just a Button) 59.85 KB (0% 🟰) Yes 🎉
Tree shaking (just tasty) 35.76 KB (0% 🟰) Yes 🎉

Click here if you want to find out what is changed in this build

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

// In dark+auto mode, flip the contrast sign
if (isDark && mode === 'auto') {
contrast = -contrast;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dark mode dependent colors broken without minContrast

High Severity

Dependent colors using auto mode (default) without minContrast produce incorrect lightness in dark scheme. The contrast sign flip causes colors to move in the wrong direction. For example, a text color with contrast: 52 from a light surface (97→12.4 in dark) becomes pure black (0) instead of lighter (~65) for readable contrast. This only affects colors without minContrast since the solver corrects it when specified.

Fix in Cursor Fix in Web

*/
export function formatOkhsl(h: number, s: number, l: number): string {
return `okhsl(${h.toFixed(1)} ${s.toFixed(1)}% ${l.toFixed(1)}%)`;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OKHSL conversion algorithm duplicated across files

Low Severity

The OKHSL color conversion algorithm is duplicated between okhsl-to-rgb.ts and okhsl-color-math.ts. While they have different output formats (gamma-encoded vs linear RGB), the core pipeline including computeMaxSaturationOKLC, findCuspOKLCH, findGamutIntersectionOKLCH, and related functions are identical. This increases maintenance burden - bugs in the algorithm need fixing in two places.

Fix in Cursor Fix in Web

return Math.max(1, value);
}
return CONTRAST_PRESETS[value];
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing validation for minContrast preset strings

Medium Severity

The resolveMinContrast function returns CONTRAST_PRESETS[value] without validating that value is a valid preset key. When theme configs are loaded from JSON or used without TypeScript, an invalid preset string (like 'AA-Large' with wrong capitalization) returns undefined, which propagates as NaN through contrast calculations, silently breaking color output instead of failing with a clear error.

Fix in Cursor Fix in Web


function pairHC<T>(p: HCPair<T>): T {
return Array.isArray(p) ? p[1] : p;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing validation for HCPair array length

Medium Severity

The pairHC function accesses array index [1] without validating that HCPair arrays contain exactly two elements. When theme configs are loaded from JSON or used without TypeScript, a single-element array like { l: [97] } returns undefined for the high-contrast value, propagating as NaN through color calculations and silently producing invalid output.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant