Gim/internal/theme/theme_json.go
Hayden Hargreaves 273be90d42 feat: HUGE refactor of colorschemes, untested.
Now we can load them in via JSON files at launch time. They are embded
in the final exe though...
2026-04-08 11:59:49 -07:00

54 lines
1.6 KiB
Go

package theme
// ThemeJSON is the file-backed theme DTO used for JSON unmarshalling.
//
// This mirrors the format documented in internal/theme/themes/README.md.
// It is intentionally string-based so values can be validated and compiled
// into EditorTheme styles in a separate step.
type ThemeJSON struct {
Name string `json:"name"`
Line ColorStyleJSON `json:"line"`
Background ColorStyleJSON `json:"background"`
VisualHighlight ColorStyleJSON `json:"visual_highlight"`
Cursors CursorJSON `json:"cursors"`
Gutter GutterJSON `json:"gutter"`
StatusBar StatusBarJSON `json:"status_bar"`
CommandLine CommandLineJSON `json:"command_line"`
Syntax SyntaxJSON `json:"syntax"`
}
// ColorStyleJSON represents a simple fg/bg style entry.
//
// For v1 themes, only color values are supported.
type ColorStyleJSON struct {
FG string `json:"fg,omitempty"`
BG string `json:"bg,omitempty"`
}
type CursorJSON struct {
Normal ColorStyleJSON `json:"normal"`
Insert ColorStyleJSON `json:"insert"`
Command ColorStyleJSON `json:"command"`
Replace ColorStyleJSON `json:"replace"`
}
type GutterJSON struct {
Default ColorStyleJSON `json:"default"`
CurrentLine ColorStyleJSON `json:"current_line"`
}
type StatusBarJSON struct {
Default ColorStyleJSON `json:"default"`
}
type CommandLineJSON struct {
Error ColorStyleJSON `json:"error"`
OutputBorder ColorStyleJSON `json:"output_border"`
ContinueMessage ColorStyleJSON `json:"continue_message"`
}
type SyntaxJSON struct {
Group map[string]string `json:"group"`
Exact map[string]string `json:"exact"`
}