Overview
The theme system provides a complete theming solution with 9 pre-configured themes and support for custom theme creation. Each theme defines colors for the editor, sidebar, status bar, and syntax highlighting.
Available Themes
The THEMES array contains all available theme configurations:
Light (vs) Classic light theme with high contrast
Dark (vs-dark) Standard dark theme with blue accents
GitHub Dark GitHub’s dark color scheme
GitHub Light GitHub’s light color scheme
Dracula Popular purple-tinted dark theme
Monokai Classic Monokai color scheme
Nord Arctic-inspired blue theme
One Dark Pro Atom-inspired dark theme
Tokyo Night Japanese night-inspired theme
ThemeConfig Interface
Defines the structure of a theme configuration object.
Unique identifier for the theme (e.g., "vs-dark", "dracula")
Display name shown in the UI (e.g., "Dark", "Dracula")
Editor area styling configuration Background color (hex format)
Foreground/text color (hex format)
Optional font family override. Default: "'Geist Mono', 'Fira Code', 'JetBrains Mono', Consolas, 'Courier New', monospace"
File explorer sidebar styling Background color (hex format)
Bottom status bar styling Background color (hex format)
Application body/background styling Background color (hex format)
Open file tab styling Background color (hex format)
Syntax highlighting color definitions Keywords like if, const, return
Type names and annotations
Functions
getTheme
Retrieves a theme configuration by ID. Falls back to the first theme (Light) if the ID is not found.
Theme identifier to retrieve
The matching theme configuration object, or the default Light theme
import { getTheme } from './lib/themes' ;
const darkTheme = getTheme ( 'vs-dark' );
const customTheme = getTheme ( 'tokyo-night' );
const fallback = getTheme ( 'nonexistent' ); // Returns Light theme
Usage Examples
Accessing Theme Properties
import { getTheme } from './lib/themes' ;
const theme = getTheme ( 'dracula' );
// Access editor colors
console . log ( theme . editor . bg ); // "#282a36"
console . log ( theme . editor . fg ); // "#f8f8f2"
// Access syntax colors
console . log ( theme . syntax . keyword ); // "#ff79c6"
console . log ( theme . syntax . string ); // "#f1fa8c"
Creating a Custom Theme
import { ThemeConfig } from './lib/types' ;
const customTheme : ThemeConfig = {
id: 'my-theme' ,
name: 'My Custom Theme' ,
editor: {
bg: '#1a1a1a' ,
fg: '#e0e0e0' ,
fontFamily: "'Fira Code', monospace"
},
sidebar: {
bg: '#0d0d0d' ,
fg: '#cccccc'
},
statusbar: {
bg: '#007acc' ,
fg: '#ffffff'
},
syntax: {
keyword: '#569cd6' ,
string: '#ce9178' ,
comment: '#6a9955' ,
number: '#b5cea8' ,
function: '#dcdcaa' ,
operator: '#d4d4d4' ,
variable: '#9cdcfe' ,
type: '#4ec9b0' ,
property: '#9cdcfe' ,
bracket: '#ffd700' ,
tag: '#569cd6' ,
attribute: '#9cdcfe' ,
heading: '#569cd6' ,
emphasis: '#ce9178' ,
strong: '#ce9178' ,
link: '#3794ff'
}
};
Using with EditorContext
import { useEditor } from './lib/editor-context' ;
function ThemeSelector () {
const { currentTheme , setSelectedTheme } = useEditor ();
return (
< div style = {{
backgroundColor : currentTheme . editor . bg ,
color : currentTheme . editor . fg
}} >
< button onClick = {() => setSelectedTheme ( 'dracula' )} >
Switch to Dracula
</ button >
</ div >
);
}
Theme List
All available theme IDs for use with getTheme() or setSelectedTheme():
vs - Light
vs-dark - Dark
github-dark - GitHub Dark
github-light - GitHub Light
dracula - Dracula
monokai - Monokai
nord - Nord
one-dark-pro - One Dark Pro
tokyo-night - Tokyo Night