SyntaxTheme class final
A VS Code color theme: the JSON of a *-color-theme.json file.
The constructor is const, so bundled themes cost nothing until they
are used. Parsing happens on first use and is cached per json map,
so json must not change after the theme is first used.
Constructors
-
SyntaxTheme({required String name, required Map<
String, Object?> json}) -
A theme called
namefrom its decodedjson.const -
SyntaxTheme.fromJson(Map<
String, Object?> json, {String? name}) -
Parses a theme from decoded JSON. If
nameis omitted, it comes from the JSON'snamefield.factory
Properties
- background → int
-
The editor background color (
editor.background).no setter - cursorForeground → int
-
Cursor color (
editorCursor.foreground), or foreground.no setter - foreground → int
-
The default text color (
editor.foreground).no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- isDark → bool
-
Whether this is a dark theme, from its
typefield or the background luminance.no setter -
json
→ Map<
String, Object?> -
The theme's decoded JSON.
final
- lineNumberForeground → int
-
Line number color (
editorLineNumber.foreground), or foreground at 40% opacity.no setter - name → String
-
The theme's name, such as
github-dark.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectionBackground → int
-
Selected text background (
editor.selectionBackground), or VS Code's default for a dark or light theme.no setter
Methods
-
editorColor(
String key) → int? -
An editor color from the theme's
colorsmap, such aseditorLineNumber.foreground. Returnsnullif absent or not a hex color. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
styleFor(
ScopeStack scopes) → TokenStyle - The style for a token with the given scopes.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
Two themes are equal when they wrap the same JSON object, so caches
keyed on a theme survive rebuilding the wrapper.
override