theme

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const Default = "dark"

Default is the name of the default theme.

Variables

This section is empty.

Functions

func GetName

func GetName() string

GetName returns the current global theme name.

func IsTransparent

func IsTransparent() bool

IsTransparent returns whether the active global theme is configured as transparent.

func List

func List() []string

List returns a slice of all available theme names (built-in and custom).

func Set

func Set(name string) error

Set updates the active global theme.

func SetClient

func SetClient(client Client)

SetClient updates the active client type and refreshes the scheme.

func SetTransparent

func SetTransparent(transparent bool)

SetTransparent sets whether the active global theme should be transparent.

func UseName

func UseName() string

UseName returns the current theme name in a reactive hook context.

Types

type AgentColor

type AgentColor struct {
	Brand      color.Color
	Thinking   color.Color
	Generating color.Color
	Executing  color.Color
	Permission color.Color
	Subagents  SubagentColors
}

type BorderColor

type BorderColor struct {
	Default color.Color
	Subtle  color.Color
	Focus   color.Color
	Accent  color.Color
	Info    color.Color
	Success color.Color
	Warning color.Color
	Error   color.Color
}

type BrandMarkColor

type BrandMarkColor struct {
	Top    color.Color
	Center color.Color
	Base   color.Color
}

func BrandMarkColors

func BrandMarkColors() BrandMarkColor

type Client

type Client string

Client represents the type of client consuming the theme.

const (
	ClientCLI     Client = "cli"
	ClientTUI     Client = "tui"
	ClientDesktop Client = "desktop"
)

func GetClient

func GetClient() Client

GetClient returns the currently configured client type.

type ClientOverride

type ClientOverride struct {
	Transparent *bool             `json:"transparent,omitempty"`
	Palette     map[string]string `json:"palette,omitempty"`
	Colors      ThemeColors       `json:"colors"`
}

ClientOverride represents client-specific overrides for a theme.

type Color

type Color struct {
	Text       TextColor
	Surface    SurfaceColor
	Tint       TintColor
	Border     BorderColor
	Icon       IconColor
	Agent      AgentColor
	Mode       ModeColor
	Diff       DiffColor
	Transcript TranscriptColor
	Meter      MeterColor
	Syntax     SyntaxColor
	BrandMark  BrandMarkColor
}

Color represents the resolved theme colors.

type DiffColor

type DiffColor struct {
	AddedBg       color.Color
	AddedText     color.Color
	AddedWord     color.Color
	AddedDimmed   color.Color
	RemovedBg     color.Color
	RemovedText   color.Color
	RemovedWord   color.Color
	RemovedDimmed color.Color
	HunkBg        color.Color
	HunkText      color.Color
}

type IconColor

type IconColor struct {
	Primary   color.Color
	Secondary color.Color
	Muted     color.Color
	Accent    color.Color
	Info      color.Color
	Success   color.Color
	Warning   color.Color
	Error     color.Color
}

type MeterColor

type MeterColor struct {
	Fill   color.Color
	Warn   color.Color
	Danger color.Color
	Empty  color.Color
}

type ModeColor

type ModeColor struct {
	Default     color.Color
	Plan        color.Color
	AcceptEdits color.Color
	Auto        color.Color
	Ask         color.Color
	Bash        color.Color
}

type Scheme

type Scheme struct {
	Name        string
	Type        string
	Transparent bool
	Palette     map[string]color.Color
	Color       Color
}

Scheme represents the resolved theme values.

func Get

func Get() *Scheme

Get returns the current active scheme snapshot.

func Resolve

func Resolve(t *Theme) (*Scheme, error)

Resolve converts a Theme (JSON) to a Scheme (Resolved) using the currently configured client.

func ResolveFor

func ResolveFor(t *Theme, client Client) (*Scheme, error)

ResolveFor converts a Theme (JSON) to a Scheme (Resolved) for a specific client.

func UseTheme

func UseTheme() *Scheme

UseTheme returns the current theme from the reactive store.

func (*Scheme) WithTransparent

func (s *Scheme) WithTransparent(transparent bool) *Scheme

WithTransparent returns a copy of Scheme with the transparent setting applied. When transparent is true, surface Canvas, Panel, Hover, Active, and Disabled are cleared to nil (Elevated, Code, Selected, and Tint.* remain intact).

type SubagentColors

type SubagentColors struct {
	Red    color.Color
	Blue   color.Color
	Green  color.Color
	Yellow color.Color
	Purple color.Color
	Orange color.Color
	Pink   color.Color
	Cyan   color.Color
}

type SurfaceColor

type SurfaceColor struct {
	Canvas   color.Color
	Panel    color.Color
	Elevated color.Color
	Code     color.Color
	Hover    color.Color
	Active   color.Color
	Selected color.Color
	Disabled color.Color
}

type SyntaxColor

type SyntaxColor struct {
	Keyword     color.Color
	Function    color.Color
	String      color.Color
	Number      color.Color
	Type        color.Color
	Comment     color.Color
	Operator    color.Color
	Variable    color.Color
	Punctuation color.Color
}

type TextColor

type TextColor struct {
	Primary   color.Color
	Secondary color.Color
	Muted     color.Color
	Disabled  color.Color
	Inverse   color.Color
	Accent    color.Color
	Info      color.Color
	Success   color.Color
	Warning   color.Color
	Error     color.Color
}

type Theme

type Theme struct {
	Name        string                    `json:"name"`
	Extends     string                    `json:"extends,omitempty"`
	Type        string                    `json:"type"` // "dark" or "light"
	Transparent *bool                     `json:"transparent,omitempty"`
	Palette     map[string]string         `json:"palette,omitempty"`
	Colors      ThemeColors               `json:"colors"`
	Clients     map[Client]ClientOverride `json:"clients,omitempty"`
}

Theme represents the JSON structure of a theme.

func Find

func Find(name string) (*Theme, error)

Find looks for a theme by name in user configuration first, then falls back to built-ins.

func Load

func Load(path string) (*Theme, error)

Load parses a JSON theme file from the given path.

type ThemeAgentColor

type ThemeAgentColor struct {
	Brand      string              `json:"brand"`
	Thinking   string              `json:"thinking"`
	Generating string              `json:"generating"`
	Executing  string              `json:"executing"`
	Permission string              `json:"permission"`
	Subagents  ThemeSubagentColors `json:"subagents"`
}

type ThemeBorderColor

type ThemeBorderColor struct {
	Default string `json:"default"`
	Subtle  string `json:"subtle"`
	Focus   string `json:"focus"`
	Accent  string `json:"accent"`
	Info    string `json:"info"`
	Success string `json:"success"`
	Warning string `json:"warning"`
	Error   string `json:"error"`
}

type ThemeColors

type ThemeColors struct {
	Text       ThemeTextColor       `json:"text"`
	Surface    ThemeSurfaceColor    `json:"surface"`
	Tint       ThemeTintColor       `json:"tint"`
	Border     ThemeBorderColor     `json:"border"`
	Icon       ThemeIconColor       `json:"icon"`
	Agent      ThemeAgentColor      `json:"agent"`
	Mode       ThemeModeColor       `json:"mode"`
	Diff       ThemeDiffColor       `json:"diff"`
	Transcript ThemeTranscriptColor `json:"transcript"`
	Meter      ThemeMeterColor      `json:"meter"`
	Syntax     ThemeSyntaxColor     `json:"syntax"`
}

ThemeColors represents all 11 token groups in theme configuration.

type ThemeDiffColor

type ThemeDiffColor struct {
	AddedBg       string `json:"added_bg"`
	AddedText     string `json:"added_text"`
	AddedWord     string `json:"added_word"`
	AddedDimmed   string `json:"added_dimmed"`
	RemovedBg     string `json:"removed_bg"`
	RemovedText   string `json:"removed_text"`
	RemovedWord   string `json:"removed_word"`
	RemovedDimmed string `json:"removed_dimmed"`
	HunkBg        string `json:"hunk_bg"`
	HunkText      string `json:"hunk_text"`
}

type ThemeIconColor

type ThemeIconColor struct {
	Primary   string `json:"primary"`
	Secondary string `json:"secondary"`
	Muted     string `json:"muted"`
	Accent    string `json:"accent"`
	Info      string `json:"info"`
	Success   string `json:"success"`
	Warning   string `json:"warning"`
	Error     string `json:"error"`
}

type ThemeMeterColor

type ThemeMeterColor struct {
	Fill   string `json:"fill"`
	Warn   string `json:"warn"`
	Danger string `json:"danger"`
	Empty  string `json:"empty"`
}

type ThemeModeColor

type ThemeModeColor struct {
	Default     string `json:"default"`
	Plan        string `json:"plan"`
	AcceptEdits string `json:"accept_edits"`
	Auto        string `json:"auto"`
	Ask         string `json:"ask"`
	Bash        string `json:"bash"`
}

type ThemeSubagentColors

type ThemeSubagentColors struct {
	Red    string `json:"red"`
	Blue   string `json:"blue"`
	Green  string `json:"green"`
	Yellow string `json:"yellow"`
	Purple string `json:"purple"`
	Orange string `json:"orange"`
	Pink   string `json:"pink"`
	Cyan   string `json:"cyan"`
}

type ThemeSurfaceColor

type ThemeSurfaceColor struct {
	Canvas   string `json:"canvas"`
	Panel    string `json:"panel"`
	Elevated string `json:"elevated"`
	Code     string `json:"code"`
	Hover    string `json:"hover"`
	Active   string `json:"active"`
	Selected string `json:"selected"`
	Disabled string `json:"disabled"`
}

type ThemeSyntaxColor

type ThemeSyntaxColor struct {
	Keyword     string `json:"keyword"`
	Function    string `json:"function"`
	String      string `json:"string"`
	Number      string `json:"number"`
	Type        string `json:"type"`
	Comment     string `json:"comment"`
	Operator    string `json:"operator"`
	Variable    string `json:"variable"`
	Punctuation string `json:"punctuation"`
}

type ThemeTextColor

type ThemeTextColor struct {
	Primary   string `json:"primary"`
	Secondary string `json:"secondary"`
	Muted     string `json:"muted"`
	Disabled  string `json:"disabled"`
	Inverse   string `json:"inverse"`
	Accent    string `json:"accent"`
	Info      string `json:"info"`
	Success   string `json:"success"`
	Warning   string `json:"warning"`
	Error     string `json:"error"`
}

type ThemeTintColor

type ThemeTintColor struct {
	Accent  string `json:"accent"`
	Info    string `json:"info"`
	Success string `json:"success"`
	Warning string `json:"warning"`
	Error   string `json:"error"`
}

type ThemeTranscriptColor

type ThemeTranscriptColor struct {
	UserBg      string `json:"user_bg"`
	UserHoverBg string `json:"user_hover_bg"`
	BashBg      string `json:"bash_bg"`
	SystemText  string `json:"system_text"`
	QueuedText  string `json:"queued_text"`
}

type TintColor

type TintColor struct {
	Accent  color.Color
	Info    color.Color
	Success color.Color
	Warning color.Color
	Error   color.Color
}

type TranscriptColor

type TranscriptColor struct {
	UserBg      color.Color
	UserHoverBg color.Color
	BashBg      color.Color
	SystemText  color.Color
	QueuedText  color.Color
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL