Skip to main content

Available Themes

Markdown-OS includes 6 built-in themes with automatic syntax highlighting and Mermaid coordination:
Clean, professional light theme with blue accents.
  • Background: #f7f8fa (light gray)
  • Text: #17233b (dark blue-gray)
  • Accent: #2563eb (blue)

Switching Themes

Theme Dropdown

Click the color dots in the top-right corner to open the theme selector:
The dropdown shows:
  • Theme name (e.g., “Default Dark”)
  • Color preview dots (background, text, accent)
  • Active theme indicator (checkmark)

Keyboard Navigation

The theme dropdown is fully keyboard accessible:
  • Enter or Space - Open/close dropdown
  • Arrow Up/Down - Navigate themes
  • Enter - Select highlighted theme
  • Escape - Close dropdown

Theme Persistence

Selected themes are saved to localStorage:
Your theme preference persists across:
  • Browser restarts
  • Different files and directories
  • Multiple editor sessions
If localStorage is unavailable (private browsing, storage quota exceeded), themes fall back to system preference.

System Theme Detection

On first launch, the editor detects your operating system’s color scheme:
This uses the prefers-color-scheme CSS media query to match your system settings:
  • macOS: System Preferences → General → Appearance
  • Windows: Settings → Personalization → Colors
  • Linux: Varies by desktop environment
Changing your system theme while the editor is open triggers automatic theme updates if you haven’t manually selected a theme.

Theme Architecture

CSS Custom Properties

Themes are implemented with CSS variables in themes.css:
All UI components reference these variables:

Theme Application

When you select a theme, the ThemeManager class:
  1. Sets data attribute on <html> element:
  2. Updates highlight.js stylesheet:
  3. Configures Mermaid theme:
  4. Emits theme change event:
Changing themes re-renders all Mermaid diagrams to match the new color scheme.

Syntax Highlighting

Highlight.js Integration

Each theme specifies a highlight.js stylesheet: The stylesheet is dynamically loaded:
Code blocks are highlighted using:

Mermaid Theme Coordination

Mermaid diagrams use theme-coordinated color schemes:
This ensures diagrams match your selected theme automatically.

Creating Custom Themes

While Markdown-OS doesn’t currently support user-defined themes in the UI, you can add custom themes by modifying the source:
1

Define theme object

Add your theme to the THEMES array in static/js/theme.js:
2

Add CSS variables

Define your theme’s CSS custom properties in static/css/themes.css:
3

Test and refine

Reload the editor and select your custom theme from the dropdown. Test all UI components to ensure consistent appearance.
Copy an existing theme definition and modify colors incrementally. The dots array should contain representative colors for the preview in the theme dropdown.

Theme Variables Reference

Common variables used across themes:

Core Colors

Semantic Colors

Component-Specific

File Tree & Tabs

Accessibility Considerations

Color Contrast

All themes meet WCAG AA contrast requirements for normal text (4.5:1):

Reduced Motion

Theme transitions respect the prefers-reduced-motion setting:

Focus Indicators

Focus rings use theme-aware accent colors:

Performance

Theme Switching Speed

Theme changes are near-instantaneous because:
  • CSS variables update synchronously
  • No page reload required
  • Highlight.js stylesheet loads from CDN cache
  • Mermaid diagrams re-render asynchronously

Initial Load

The editor applies the saved theme before first paint to prevent flashing:
This prevents the brief flash of default styles during page load.