fix: add default theme for no-js users#1060
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThe pull request modifies the main CSS file to add a new CSS rule that applies theme-related custom properties to the root selector when the theme is not light or explicitly dark. This change introduces centralized definitions for background, foreground, border, accent, syntax highlighting, and badge colour variables in a combined root selector. The modification is purely additive with no deletions, reorganising dark-theme variable definitions. Possibly related issues
Possibly related PRs
Suggested reviewers
🚥 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)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/assets/main.css (1)
128-139:⚠️ Potential issue | 🟡 MinorHigh contrast mode doesn't cover no-JS users.
The
prefers-contrast: moremedia query targets only:root[data-theme='dark'], but no-JS users will have nodata-themeattribute set. Consider updating the selector to match the pattern used above:Proposed fix
`@media` (prefers-contrast: more) { - :root[data-theme='dark'] { + :root:not([data-theme='light']), + :root[data-theme='dark'] { /* text colors */ --fg: oklch(1 0 0);
I simply added that if the theme isn't defined, the colors from the dark theme are used.
This won't be a problem for JS users, as the browser won't apply the colors until the head is complete, and nuxt-theme determines the current theme in the head.
I used :not() to avoid unnecessary variables and improve debugging experience
Closes #939 #1059