Help us shape the future of Go! Take the 2026 Go Developer Survey

theme

package
v0.19.12 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BG

func BG(color, text string) string

func BGANSI

func BGANSI(color string) string

func BashModeBorderColor

func BashModeBorderColor() func(string) string

func Bold

func Bold(value string) string

func ColorModeGlobal

func ColorModeGlobal() string

func EditorTheme

func EditorTheme() tui.EditorTheme

func FG

func FG(color, text string) string

func FGANSI

func FGANSI(color string) string

func GetAllThemes

func GetAllThemes() []extensions.ThemeInfo

func Highlight

func Highlight(code, language string, theme *Theme) []string

func Inverse

func Inverse(value string) string

func Italic

func Italic(value string) string

func LanguageFromPath

func LanguageFromPath(path string) string

func MarkdownTheme

func MarkdownTheme() tui.MarkdownTheme

func ResolveSetting

func ResolveSetting(setting string, terminal TerminalTheme) (string, bool)

func SetCurrent

func SetCurrent(t *Theme)

func SetTheme

func SetTheme(name string) error

func Shimmer added in v0.19.12

func Shimmer(text string, elapsed time.Duration) string

Shimmer draws plain text in the muted color with a band of the text color sweeping across it, elapsed after the sweep began. A palette without truecolor for both, or text that brings its own styling, stays muted.

func Strikethrough

func Strikethrough(value string) string

func ThinkingBorderColor

func ThinkingBorderColor(level engine.ThinkingLevel) func(string) string

func Underline

func Underline(value string) string

Types

type AutoSetting

type AutoSetting struct {
	Light string
	Dark  string
}

func ParseAutoSetting

func ParseAutoSetting(setting string) (AutoSetting, bool)

type Collision

type Collision = themefile.Collision

type ColorMode

type ColorMode string
const (
	TrueColor ColorMode = "truecolor"
	Color256  ColorMode = "256color"
)

func DetectColorMode

func DetectColorMode(environment map[string]string) ColorMode

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func Initialize

func Initialize(registry *Registry, setting string, terminal TerminalTheme, onChange func()) *Controller

Initialize installs the production registry/controller used by package-level render helpers and extension theme APIs.

func NewController

func NewController(registry *Registry, setting string, terminal TerminalTheme, onChange func()) *Controller

func (*Controller) Available

func (controller *Controller) Available() []string

func (*Controller) Current

func (controller *Controller) Current() *Theme

func (*Controller) Name

func (controller *Controller) Name() string

func (*Controller) Reload

func (controller *Controller) Reload() error

func (*Controller) Set

func (controller *Controller) Set(setting string) error

func (*Controller) SetInstance

func (controller *Controller) SetInstance(value *Theme) error

func (*Controller) SetTerminalAppearance added in v0.19.1

func (controller *Controller) SetTerminalAppearance(appearance TerminalTheme)

SetTerminalAppearance follows pairs, never explicit names or extension instances.

type Detection

type Detection struct {
	Theme      TerminalTheme
	Source     string
	Detail     string
	Confidence string
}

func DetectBackground

func DetectBackground(environment map[string]string) Detection

type Diagnostic

type Diagnostic = themefile.Diagnostic

type LoadOptions

type LoadOptions struct {
	CWD                  string
	AgentDir             string
	ProjectTrusted       bool
	NoThemes             bool
	Mode                 ColorMode
	GlobalPaths          []string
	ProjectPaths         []string
	PackagePaths         []string
	AdditionalPaths      []string
	ResourceDiscoverPath []string
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func Load

func Load(options LoadOptions) *Registry

func (*Registry) Available

func (registry *Registry) Available() []string

func (*Registry) Diagnostics

func (registry *Registry) Diagnostics() []Diagnostic

func (*Registry) Extend

func (registry *Registry) Extend(paths []string)

func (*Registry) Get

func (registry *Registry) Get(name string) (*Theme, bool)

func (*Registry) Loaded

func (registry *Registry) Loaded() []*Theme

Loaded returns non-builtin themes in first-winner path order. ResourceLoader exposes these exact objects to interactive mode, matching upstream identity.

func (*Registry) Mode added in v0.10.0

func (registry *Registry) Mode() ColorMode

Mode is the color mode the registry renders loaded themes in.

func (*Registry) Register

func (registry *Registry) Register(theme *Theme) error

func (*Registry) ReplaceLoaded

func (registry *Registry) ReplaceLoaded(themes []*Theme) error

ReplaceLoaded atomically replaces every nonbuiltin theme with the supplied loader-owned objects. Validation happens before mutation so a bad override leaves the prior registered set intact.

type TerminalTheme

type TerminalTheme string
const (
	Dark  TerminalTheme = "dark"
	Light TerminalTheme = "light"
)

func BackgroundAppearance added in v0.19.1

func BackgroundAppearance(background tui.RgbColor) TerminalTheme

BackgroundAppearance uses the crossover where black and white have equal contrast.

type Theme

type Theme struct {
	Name       string
	SourcePath string
	SourceInfo *extensions.SourceInfo
	// contains filtered or unexported fields
}

func Current

func Current() *Theme

func FromFile added in v0.10.0

func FromFile(source *themefile.Theme, mode ColorMode) *Theme

FromFile renders a parsed theme resource for a terminal color mode.

func GetTheme

func GetTheme(name string) *Theme

func Parse

func Parse(label string, data []byte, mode ColorMode) (*Theme, error)

func (*Theme) Appearance added in v0.14.0

func (theme *Theme) Appearance() string

Appearance is the background the theme is designed for: declared in its file, else detected from its own colors, else the terminal's.

func (*Theme) Background

func (theme *Theme) Background(name, value string) string

func (*Theme) BackgroundANSI

func (theme *Theme) BackgroundANSI(name string) (string, error)

func (*Theme) ClearTerminalBackground added in v0.8.0

func (theme *Theme) ClearTerminalBackground()

ClearTerminalBackground restores terminal-native colors after a failed query.

func (*Theme) ColorMode

func (theme *Theme) ColorMode() ColorMode

func (*Theme) Colors added in v0.14.0

func (theme *Theme) Colors() map[string]string

Colors returns every token's concrete color as #rrggbb. Tokens left to the terminal default get the usual default color for the theme's appearance.

func (*Theme) ExportColors

func (theme *Theme) ExportColors() map[string]string

func (*Theme) Fade added in v0.13.2

func (theme *Theme) Fade(lines []string, opacity float64) []string

Fade draws lines as if at opacity over the page: every truecolor foreground and background blends toward the page color, the terminal's default foreground included. A palette without a known page (256 colors, a theme without pageBg) uses the terminal's faint attribute instead.

func (*Theme) Foreground

func (theme *Theme) Foreground(name, value string) string

func (*Theme) ForegroundANSI

func (theme *Theme) ForegroundANSI(name string) (string, error)

func (*Theme) Markdown

func (theme *Theme) Markdown(codeBlockIndent string) tui.MarkdownTheme

func (*Theme) Palette added in v0.8.0

func (theme *Theme) Palette() *Theme

Palette identifies the immutable colors used by cached renderers.

func (*Theme) ResolvedColors

func (theme *Theme) ResolvedColors(light bool) map[string]string

func (*Theme) SetTerminalBackground added in v0.7.1

func (theme *Theme) SetTerminalBackground(background tui.RgbColor)

SetTerminalBackground swaps an immutable palette so existing render closures adopt terminal appearance changes without rebuilding conversation components.

Jump to

Keyboard shortcuts

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