Theming System
Theme system, custom themes, and color format guide
Available Themes
Rizzo CSS includes 14 carefully crafted themes organized into light and dark categories. Each theme has its own dedicated page with detailed information, color palettes, and usage examples. Click on any theme card below to learn more about it.
Dark Themes
Official GitHub dark theme for VS Code
Professional theme with bold purple shades
Dark, red-based theme for late-night coding
Dark theme with blood-orange accent
Minimal dark theme with neon yellow accent
Dark blue with lime green accent, built for hackers
Sweet and cute dark theme with rose pink accents
Light Themes
Official GitHub light theme for VS Code
Velvet-cupcake light theme with red accent
Light theme with orange accent
Yellow light theme
Green and blue focused light theme with good contrast
Cute pink light theme for VSCode
Light aesthetic theme with soft purple tones
Using Themes
Setting Theme
Set the theme via the data-theme attribute on the HTML element:
<html lang="en" data-theme="github-dark-classic"> Programmatic Theme Switching
The ThemeSwitcher component handles theme switching automatically. It:
- Updates the
data-themeattribute - Persists choice in
localStorage - Updates all components instantly
Manual Theme Switching
// Set theme
document.documentElement.setAttribute('data-theme', 'shades-of-purple');
// Save to localStorage
localStorage.setItem('theme', 'shades-of-purple');
// Load saved theme
const savedTheme = localStorage.getItem('theme') || 'github-dark-classic';
document.documentElement.setAttribute('data-theme', savedTheme); Theme File Structure
Themes are organized in src/styles/themes/:
themes/
âââ dark/
â âââ github-dark-classic.css
â âââ shades-of-purple.css
â âââ sandstorm-classic.css
â âââ rocky-blood-orange.css
â âââ minimal-dark-neon-yellow.css
â âââ hack-the-box.css
â âââ pink-cat-boo.css
âââ light/
âââ github-light.css
âââ red-velvet-cupcake.css
âââ orangy-one-light.css
âââ sunflower.css
âââ green-breeze-light.css
âââ cute-pink.css
âââ semi-light-purple.css Creating Custom Themes
- Create a new theme file in
src/styles/themes/dark/orsrc/styles/themes/light/ - Use the
[data-theme="your-theme-name"]selector - Define all semantic variables including contrast-aware text colors
- Import in
src/styles/main.css
Example Theme
/* My Custom Theme */
/* Author: Your Name */
[data-theme="my-theme"] {
--bg: oklch(15% 0.015 270.5deg);
--bg-alt: oklch(12% 0.012 270.5deg);
--fg: oklch(95% 0.003 100.2deg);
--fg-dim: oklch(85% 0.003 100.2deg);
--current-line: oklch(25% 0.022 270.5deg);
--selection: oklch(25% 0.022 270.5deg);
/* Accent colors */
--accent-color: oklch(65% 0.180 290.1deg);
--accent-hover-color: oklch(70% 0.195 340.1deg);
/* Semantic mappings */
--background: var(--bg);
--background-alt: var(--bg-alt);
--text: var(--fg);
--text-dim: var(--fg-dim);
--border: var(--current-line);
--accent: var(--accent-color);
--accent-hover: var(--accent-hover-color);
/* Contrast-aware text colors */
--accent-text: oklch(100% 0 0deg); /* White text for dark accent */
--success-text: oklch(100% 0 0deg);
--warning-text: oklch(20% 0 0deg); /* Dark text for light yellow */
--error-text: oklch(100% 0 0deg);
--info-text: oklch(100% 0 0deg);
} Contrast Text Colors
When creating themes, ensure proper contrast by setting text colors based on background lightness:
- Dark backgrounds (< 50% lightness): Use white text (
oklch(100% 0 0deg)) - Light backgrounds (>= 50% lightness): Use dark text (
oklch(20% 0 0deg)) - Warning colors (typically 80%+ lightness): Always use dark text
This ensures WCAG AA compliance (4.5:1 contrast ratio for normal text).
Color Format
All themes use OKLCH format with percentages and degrees:
--bg: oklch(15% 0.015 270.5deg); Format: oklch(lightness% chroma hue)
OKLCH Benefits
- Perceptually uniform color space
- Better color manipulation
- Consistent appearance across displays
Color Conversion
To convert from hex to OKLCH:
- Use online tools like oklch.com
- Or use hex2oklch.com
Theme Persistence
The theme switcher automatically saves the selected theme to localStorage and restores it on page load. An inline script in Layout.astro prevents theme flash by setting the theme immediately before the page renders.