Skip to content

Commit 3771e6f

Browse files
committed
Remove !important rules to allow inline style overrides
The previous fix used !important which prevented user code from setting custom colors via inline styles. Now using normal CSS specificity so that: 1. html/body elements get default colors (white on dark, dark on light) 2. Colors cascade naturally to child elements 3. User inline styles can override the inherited colors 4. External CSS works with the CSS variables we define This balances having sensible defaults with allowing full customization. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent f1eac86 commit 3771e6f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

website/src/components/code-preview.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,19 @@ function generateJavaScriptIFrameHTML(
3333
<style>
3434
/* Dark mode (default) - apply colors directly without variables */
3535
html, body {
36-
background-color: #0a0e1f !important;
37-
color: #f5f9ff !important;
36+
background-color: #0a0e1f;
37+
color: #f5f9ff;
3838
margin: 0;
3939
padding: 0;
4040
}
4141
* {
42-
color: #f5f9ff !important;
4342
box-sizing: border-box;
4443
}
4544
4645
/* Light mode overrides */
4746
html.color-scheme-light, html.color-scheme-light body {
48-
background-color: #e7f4f5 !important;
49-
color: #0a0e1f !important;
50-
}
51-
html.color-scheme-light * {
52-
color: #0a0e1f !important;
47+
background-color: #e7f4f5;
48+
color: #0a0e1f;
5349
}
5450
5551
/* CSS variables for compatibility with external CSS */

0 commit comments

Comments
 (0)