AdaptiveChromaTheme class

An adaptive syntax highlighting theme that selects between light and dark variants based on terminal background.

Similar to AdaptiveColor, this allows themes to automatically adapt to the terminal's color scheme.

// Create an adaptive theme
final theme = AdaptiveChromaTheme(
  light: ChromaTheme.github,
  dark: ChromaTheme.dracula,
);

// Use with SyntaxHighlighter
final highlighter = SyntaxHighlighter.adaptive(
  theme: theme,
  hasDarkBackground: terminalTheme.hasDarkBackground ?? true,
);

Constructors

AdaptiveChromaTheme({required ChromaTheme light, required ChromaTheme dark})
Creates an adaptive theme with light and dark variants.
const

Properties

dark ChromaTheme
Theme to use on dark terminal backgrounds.
final
hashCode int
The hash code for this object.
no setterinherited
light ChromaTheme
Theme to use on light terminal backgrounds.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve({required bool hasDarkBackground}) ChromaTheme
Selects the appropriate theme based on background.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

defaultTheme AdaptiveChromaTheme
Default adaptive theme using dark/light presets.
no setter
draculaGithub AdaptiveChromaTheme
Dracula (dark) / GitHub (light) pairing.
no setter
gruvbox AdaptiveChromaTheme
Gruvbox dark/light pairing.
no setter
monokaiGithub AdaptiveChromaTheme
Monokai (dark) / GitHub (light) pairing.
no setter
nordGithub AdaptiveChromaTheme
Nord (dark) / GitHub (light) pairing.
no setter
oneDarkLight AdaptiveChromaTheme
One Dark/Light pairing (Atom-inspired).
no setter
solarized AdaptiveChromaTheme
Solarized dark/light pairing.
no setter