termstyle

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleTitle       = termtheme.RoleTitle
	RolePrimary     = termtheme.RolePrimary
	RoleSecondary   = termtheme.RoleSecondary
	RoleAccent      = termtheme.RoleAccent
	RoleMuted       = termtheme.RoleMuted
	RoleSubtle      = termtheme.RoleSubtle
	RoleForeground  = termtheme.RoleForeground
	RoleSelected    = termtheme.RoleSelected
	RoleSelectedBar = termtheme.RoleSelectedBar
	RoleBorder      = termtheme.RoleBorder
	RoleSuccess     = termtheme.RoleSuccess
	RoleWarning     = termtheme.RoleWarning
	RoleDanger      = termtheme.RoleDanger
	RoleInfo        = termtheme.RoleInfo
	RoleSearch      = termtheme.RoleSearch
	RolePill        = termtheme.RolePill
)

Variables

View Source
var (
	ParseThemeConfig = termtheme.ParseThemeConfig
	ParseStyleSpec   = termtheme.ParseStyleSpec
	Apply            = termtheme.Apply
	VisibleWidth     = termtheme.VisibleWidth
	Strip            = termtheme.Strip
	Sanitize         = termtheme.Sanitize
	PadRight         = termtheme.PadRight
	Truncate         = termtheme.Truncate
	TruncateWith     = termtheme.TruncateWith
)

Engine functions re-exported from termtheme. Sharing these is what makes a theme written by any sibling app parse and render identically here.

View Source
var ImportTheme = termtheme.Unmarshal

ImportTheme parses a portable .theme file into a config plus its metadata.

Functions

func BuiltinThemeNames

func BuiltinThemeNames() []string

BuiltinThemeNames lists the selectable base palettes in display order. It is the single source of truth the theme editor cycles through, so adding a builtin here surfaces it in the UI automatically.

func ExportTheme

func ExportTheme(cfg ThemeConfig, base Theme, app, version string) []byte

ExportTheme serializes the resolved theme to the portable .theme format: a versioned header plus a full inline dump of every role, so the file is self-contained and interchanges with any sibling app. base is the builtin palette the config was authored against (passage Theme and termtheme.Theme share an identical layout, so the conversion is free).

func ThemeConfigPath

func ThemeConfigPath(file string, env []string) (string, error)

Types

type Role

type Role = termtheme.Role

Role is the shared semantic styling slot.

func Roles

func Roles() []Role

Roles is passage's rendered role set. passage paints every role, so it is the full universal superset.

type Theme

type Theme struct {
	Name    string
	NoColor bool
	Codes   map[Role]string
}

Theme is passage's concrete palette: a role->SGR-code map plus a NoColor switch. It is in-memory render state (never serialized — ThemeConfig is), so it stays local to passage along with its builtin palettes; the interchange surface lives in termtheme (see shim.go).

func BuiltinTheme

func BuiltinTheme(name string) (Theme, bool)

func ResolveTheme

func ResolveTheme(opts ThemeOptions) (Theme, error)

func TerminalTheme

func TerminalTheme() Theme

func VividTheme

func VividTheme() Theme

func (Theme) IsZero

func (t Theme) IsZero() bool

func (Theme) Normalized

func (t Theme) Normalized() Theme

func (Theme) Style

func (t Theme) Style(role Role, value string) string

func (Theme) WithNoColor

func (t Theme) WithNoColor(noColor bool) Theme

type ThemeConfig

type ThemeConfig = termtheme.ThemeConfig

ThemeConfig is the parsed theme file (base name + per-role overrides).

type ThemeMeta

type ThemeMeta = termtheme.Meta

ThemeMeta is the header/version info recovered from a portable .theme file.

type ThemeOptions

type ThemeOptions struct {
	Name            string
	File            string
	NoColor         bool
	Env             []string
	SkipDefaultFile bool
}

ThemeOptions selects and loads a theme. Name is deprecated and ignored; the base palette comes from the config's `theme =` line.

Jump to

Keyboard shortcuts

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