-
Notifications
You must be signed in to change notification settings - Fork 0
feat(core): refine CSS functions for perceptual uniformity #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughMakes gamut-aware adjustments to color and shadow utilities, clamps saturate/desaturate, rebuilds glow and text-shadow layers, updates contrast/readability logic (including Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/core/src/utils/functions.css`:
- Around line 121-137: The fallback function --s-contrast-text-fallback uses a
0.6 OKLCH lightness threshold which is inconsistent with the [s-dark-aware]
component's 0.55 threshold; update the fallback to use 0.55 instead of 0.6 by
changing the clamp/threshold expression inside --s-contrast-text-fallback so
both --s-contrast-text-fallback and [s-dark-aware] use the same 0.55 lightness
threshold for consistent visual results across fallbacks and native
color-contrast().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/core/src/utils/functions.css`:
- Around line 121-137: The current `@function` --s-contrast-text relies on
color-contrast(), which has no stable browser support and cannot be
feature-detected inside CSS functions (if() is Chromium-only and CSS `@supports`
works only at rule level), so change the implementation to make the fallback
reachable: either make --s-contrast-text use the logic from
--s-contrast-text-fallback as the default implementation and keep
--s-contrast-text-fallback for clarity, or keep the simple fallback in
--s-contrast-text and move any color-contrast()/contrast-color() usage into the
consumer rules using `@supports` (matching the pattern in
surface.css/button.css/badge.css) so you detect support at rule level before
applying the newer API.
Summary
Aligned all OKLCH-based CSS functions with perceptual uniformity philosophy. Functions now use modern 2026 CSS features (
color-contrast(),round()) for accurate color math and rhythm-aligned spacing.Changes
--s-saturatemin(0.4)clamp to prevent overflow--s-desaturatemax(0)prevents negative chroma values--s-glow--s-text-shadow-glow--s-contrast-textcolor-contrast()for true WCAG 2.2 compliance--s-readable-on--s-space-scaleround()quantizes output to base unit for Bento rhythmPhilosophy Alignment
color-contrast()delegates luminance calculation to browser engineRelated Issues
N/A
Checklist
bun run lintpassesbun run buildsucceedsType of Change
Additional Notes
Added
--s-contrast-text-fallbackfunction for browsers withoutcolor-contrast()support. The fallback uses the 0.6 OKLCH lightness threshold approximation.