mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-21 00:23:30 -05:00
fix(styles): make operators visible in dark mode code listings
Add syntax highlighting color overrides for dark mode to fix invisible operators (+=, +, *, =) and other code tokens. The light theme uses nearly black colors (#1A1A1A) that blend into dark backgrounds. Colors follow One Dark Pro theme palette: - Operators: cyan (#56b6c2) - Variables: light gray (#e6e6e6) - Keywords: purple (#c678dd) - Functions: blue (#61afef) - Strings: green (#98c379) - Numbers: orange (#d19a66) Closes #1106
This commit is contained in:
@@ -328,6 +328,81 @@ pre code {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
// Syntax highlighting colors for dark mode
|
||||
// These override the light theme colors that become invisible on dark backgrounds
|
||||
pre code,
|
||||
.sourceCode {
|
||||
// Operators (+=, +, *, etc.) - bright cyan for visibility
|
||||
.op {
|
||||
color: #56b6c2 !important;
|
||||
}
|
||||
|
||||
// Variables - light gray instead of black
|
||||
.va {
|
||||
color: #e6e6e6 !important;
|
||||
}
|
||||
|
||||
// Keywords (def, for, if, etc.) - keep purple but brighten
|
||||
.kw {
|
||||
color: #c678dd !important;
|
||||
}
|
||||
|
||||
// Control flow (return, break, etc.)
|
||||
.cf {
|
||||
color: #e06c75 !important;
|
||||
}
|
||||
|
||||
// Functions - bright blue/purple
|
||||
.fu {
|
||||
color: #61afef !important;
|
||||
}
|
||||
|
||||
// Built-ins - orange
|
||||
.bu {
|
||||
color: #e5c07b !important;
|
||||
}
|
||||
|
||||
// Strings - green
|
||||
.st {
|
||||
color: #98c379 !important;
|
||||
}
|
||||
|
||||
// Comments - muted gray
|
||||
.co {
|
||||
color: #7f848e !important;
|
||||
}
|
||||
|
||||
// Numbers (decimal values, floats)
|
||||
.dv, .fl {
|
||||
color: #d19a66 !important;
|
||||
}
|
||||
|
||||
// Imports
|
||||
.im {
|
||||
color: #61afef !important;
|
||||
}
|
||||
|
||||
// Attributes
|
||||
.at {
|
||||
color: #e06c75 !important;
|
||||
}
|
||||
|
||||
// Data types
|
||||
.dt {
|
||||
color: #e5c07b !important;
|
||||
}
|
||||
|
||||
// Special characters
|
||||
.sc {
|
||||
color: #56b6c2 !important;
|
||||
}
|
||||
|
||||
// Preprocessor
|
||||
.pp {
|
||||
color: #e5c07b !important;
|
||||
}
|
||||
}
|
||||
|
||||
// Figures and captions
|
||||
.figure-caption,
|
||||
.caption,
|
||||
@@ -653,6 +728,21 @@ blockquote {
|
||||
|
||||
.listing .sourceCode {
|
||||
background-color: #1e1e1e !important;
|
||||
|
||||
// Syntax highlighting within listings (higher specificity)
|
||||
.op { color: #56b6c2 !important; }
|
||||
.va { color: #e6e6e6 !important; }
|
||||
.kw { color: #c678dd !important; }
|
||||
.cf { color: #e06c75 !important; }
|
||||
.fu { color: #61afef !important; }
|
||||
.bu { color: #e5c07b !important; }
|
||||
.st { color: #98c379 !important; }
|
||||
.co { color: #7f848e !important; }
|
||||
.dv, .fl { color: #d19a66 !important; }
|
||||
.im { color: #61afef !important; }
|
||||
.at { color: #e06c75 !important; }
|
||||
.dt { color: #e5c07b !important; }
|
||||
.sc { color: #56b6c2 !important; }
|
||||
}
|
||||
|
||||
// Video containers
|
||||
|
||||
Reference in New Issue
Block a user