Theme System
Inkdown features a comprehensive theme system that supports both built-in and community themes with hot-swapping and CSS variable-based customization.Architecture
The theme system consists of three main components:- ThemeManager - Manages theme loading, switching, and color scheme
- CommunityThemeManager - Handles community theme discovery and installation
- ConfigManager - Persists theme preferences
ThemeManager
Location:packages/core/src/ThemeManager.ts
Manages theme loading, switching, and CSS injection.
Initialization
Theme Application
Built-in Themes use CSS classes already in the bundle:API
ThemeConfig Interface
CommunityThemeManager
Location:packages/core/src/CommunityThemeManager.ts
Handles community themes from GitHub releases.
Features
| Feature | Description |
|---|---|
| Theme Discovery | Fetches listings from community registry |
| GitHub Integration | Downloads themes from GitHub releases |
| Caching | 1-hour in-memory cache for listings |
| Version Tracking | Detects available updates |
| Installation | Downloads and saves theme files locally |
Theme Installation Flow
API
Types
Theme File Structure
Custom themes are stored in the app’s config directory:theme.json
CSS Files
Theme CSS must use the appropriate class selector and define CSS variables:CSS Variables Reference
Background Colors
Text Colors
Accent Colors
Border Colors
Editor Colors
Creating Custom Themes
See the Creating Themes guide for step-by-step instructions.Built-in Themes
Inkdown ships with two built-in themes:default-dark
- Modern dark theme with good contrast
- Blue accents
- Optimized for extended use
default-light
- Clean light theme
- Blue accents
- Easy on the eyes in bright environments
Theme Switching Behavior
When switching color schemes:- Theme supports both modes: Switches to the requested mode
- Theme only supports one mode: Switches to default theme for that mode
Related Documentation
- Creating Themes - Step-by-step theme creation
- Config System - Configuration persistence
- App and Managers - Manager APIs
