feat(core): enhance dark-aware component with theming#47
Merged
Conversation
📝 WalkthroughWalkthroughAdds a theme prop to the Demo component enabling 'dark', 'light', or 'split' previews, expands s-dark-aware documentation with usage and technical details, and implements container-relative theming plus OKLCH-based perceptual contrast and layered dark-mode styles in core CSS. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 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 |
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a major upgrade to the dark mode awareness system across the documentation and core CSS. The main improvements include support for container-relative theming, perceptual contrast in the OKLCH color space, and visual adaptations such as border glow and font-weight adjustments. Additionally, the documentation and demo components are enhanced to showcase and explain these features, including the ability to preview components in light, dark, or split themes.
Dark Mode Awareness and Theming Enhancements:
s-dark-awareutility infunctions.cssis now a sophisticated system that adapts to both system and parent container themes, computes readable text color using OKLCH, and visually adapts with border glow and dynamic font weight for optimal contrast and legibility. Variants for "subtle" and "strong" adaptations are introduced.s-dark-awareis expanded to explain the new system, including container-relative theming, perceptual contrast, theme islands, and the technical rationale behind each adaptation. New demos illustrate its behavior in light, dark, and split contexts.Demo Component and Documentation Improvements:
Demo.astrocomponent now accepts athemeprop ('dark' | 'light' | 'split') to force the demo preview into a specific theme or show both light and dark side-by-side. The rendering logic and container classes are updated to support this, enabling accurate previews for theme-aware components.