themes

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

README

Themes

Syntax highlighting themes, used by Orbiton and Megafile.

General info
  • License: BSD-3
  • Version: 1.0.0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitialLightBackground *bool

InitialLightBackground can be set to indicate whether the terminal has a light background.

Functions

func ParseBase16File

func ParseBase16File(filename string) (name string, colors [16]vt.AttributeColor, bgs [16]vt.AttributeColor, err error)

ParseBase16File reads a base16 YAML scheme file and returns the theme name and the 16 palette colors. It handles both the spec-0.11 format (with a "palette:" block) and the older flat format where base00..base0F are at the top level.

func RegisterBase16Colors

func RegisterBase16Colors(colors [16]vt.AttributeColor)

RegisterBase16Colors adds base16 palette entries to the vt color maps and rebuilds the tag replacers so the custom color names are recognized.

func RegisterGruvboxColors

func RegisterGruvboxColors()

RegisterGruvboxColors adds the Gruvbox palette entries to the vt color maps and rebuilds the tag replacers so the custom color names are recognized.

func RegisterMonokaiColors

func RegisterMonokaiColors()

RegisterMonokaiColors adds the Monokai palette entries to the vt color maps and rebuilds the tag replacers so the custom color names are recognized.

func RegisterVSColors

func RegisterVSColors()

RegisterVSColors adds the VS Code light palette entries to the vt color maps and rebuilds the tag replacers so the custom color names are recognized.

func RegisterXoria256Colors

func RegisterXoria256Colors()

RegisterXoria256Colors adds the Xoria256 palette entries to the vt color maps and rebuilds the tag replacers so the custom color names are recognized.

func TermHas256Colors

func TermHas256Colors() bool

TermHas256Colors reports whether the terminal supports >=256 colors. It checks TERM first: if TERM indicates a basic terminal (vt100, vt220, dumb, etc.) then COLORTERM is ignored, because some terminal emulators (e.g. Kitty) always set COLORTERM=truecolor even when TERM is overridden to a limited value.

Types

type Theme

type Theme struct {
	TextAttrValue               string
	Name                        string
	Decimal                     string
	Mut                         string
	AssemblyEnd                 string
	Whitespace                  string
	Public                      string
	Protected                   string
	Private                     string
	Class                       string
	Star                        string
	Static                      string
	Self                        string
	Tag                         string
	Dollar                      string
	String                      string
	Keyword                     string
	Comment                     string
	Type                        string
	Literal                     string
	Punctuation                 string
	Plaintext                   string
	AndOr                       string
	AngleBracket                string
	TextTag                     string
	TextAttrName                string
	CurlyBracket                string
	IncludeSystem               string
	RainbowParenColors          []vt.AttributeColor
	HeaderBulletColor           vt.AttributeColor
	MultiLineString             vt.AttributeColor
	DebugInstructionsBackground vt.AttributeColor
	Git                         vt.AttributeColor
	MultiLineComment            vt.AttributeColor
	SearchHighlight             vt.AttributeColor
	StatusErrorForeground       vt.AttributeColor
	StatusErrorBackground       vt.AttributeColor
	StatusForeground            vt.AttributeColor
	StatusBackground            vt.AttributeColor
	TopRightForeground          vt.AttributeColor
	TopRightBackground          vt.AttributeColor
	Foreground                  vt.AttributeColor
	Background                  vt.AttributeColor
	MarkdownTextColor           vt.AttributeColor
	BoxUpperEdge                vt.AttributeColor
	BoxTitleColor               vt.AttributeColor
	HeaderTextColor             vt.AttributeColor
	ListBulletColor             vt.AttributeColor
	ListTextColor               vt.AttributeColor
	ListCodeColor               vt.AttributeColor
	CodeColor                   vt.AttributeColor
	CodeBlockColor              vt.AttributeColor
	ImageColor                  vt.AttributeColor
	LinkColor                   vt.AttributeColor
	QuoteColor                  vt.AttributeColor
	QuoteTextColor              vt.AttributeColor
	HTMLColor                   vt.AttributeColor
	CommentColor                vt.AttributeColor
	BoldColor                   vt.AttributeColor
	ItalicsColor                vt.AttributeColor
	StrikeColor                 vt.AttributeColor
	TableColor                  vt.AttributeColor
	CheckboxColor               vt.AttributeColor
	XColor                      vt.AttributeColor
	DebugInstructionsForeground vt.AttributeColor
	UnmatchedParenColor         vt.AttributeColor
	MenuTitleColor              vt.AttributeColor
	MenuArrowColor              vt.AttributeColor
	MenuTextColor               vt.AttributeColor
	MenuHighlightColor          vt.AttributeColor
	MenuSelectedColor           vt.AttributeColor
	ManSectionColor             vt.AttributeColor
	ManSynopsisColor            vt.AttributeColor
	BoxTextColor                vt.AttributeColor
	BoxBackground               vt.AttributeColor
	ProgressIndicatorBackground vt.AttributeColor
	BoxHighlight                vt.AttributeColor
	DebugRunningBackground      vt.AttributeColor
	DebugStoppedBackground      vt.AttributeColor
	DebugRegistersBackground    vt.AttributeColor
	DebugOutputBackground       vt.AttributeColor
	DebugLineIndicator          vt.AttributeColor
	TableBackground             vt.AttributeColor
	JumpToLetterColor           vt.AttributeColor
	NanoHelpForeground          vt.AttributeColor
	NanoHelpBackground          vt.AttributeColor
	HighlightForeground         vt.AttributeColor
	HighlightBackground         vt.AttributeColor
	MultiCursorBackground       vt.AttributeColor
	StickyStatusBars            bool
	Light                       bool
}

Theme contains information about: * If the theme is light or dark * If syntax highlighting should be enabled * If no colors should be used * Colors for all the textual elements

func NewAmberTheme

func NewAmberTheme() Theme

func NewBase16Theme

func NewBase16Theme(name string, c [16]vt.AttributeColor, bg [16]vt.AttributeColor) Theme

NewBase16Theme creates a Theme from pre-parsed base16 foreground and background color arrays, using the same base16 slot mapping as the built-in Gruvbox theme.

func NewBlueTheme

func NewBlueTheme() Theme

func NewDarkBlueEditTheme

func NewDarkBlueEditTheme() Theme

func NewDarkVSTheme

func NewDarkVSTheme() Theme

func NewDefaultTheme

func NewDefaultTheme() Theme

NewDefaultTheme creates a new default Theme struct

func NewGrayTheme

func NewGrayTheme() Theme

func NewGreenTheme

func NewGreenTheme() Theme

func NewGruvbox16Theme

func NewGruvbox16Theme() Theme

NewGruvbox16Theme creates a 16-color approximation of the Gruvbox theme, for terminals that do not support 256 colors.

func NewGruvboxTheme

func NewGruvboxTheme() Theme

NewGruvboxTheme creates the Gruvbox theme, based on the base16 "Gruvbox dark, hard" scheme by Dawid Kurek / morhetz. Requires true-color or 256-color support.

func NewLightBlueEditTheme

func NewLightBlueEditTheme() Theme

func NewLightVSTheme

func NewLightVSTheme() Theme

func NewLitmusTheme

func NewLitmusTheme() Theme

func NewMonokai16Theme

func NewMonokai16Theme() Theme

NewMonokai16Theme creates a 16-color approximation of the Monokai theme, for terminals that do not support 256 colors.

func NewMonokaiTheme

func NewMonokaiTheme() Theme

NewMonokaiTheme creates the Monokai theme, inspired by the Monokai color scheme for TextMate by Wimer Hazenberg. Requires true-color or 256-color support.

func NewNoColorDarkBackgroundTheme

func NewNoColorDarkBackgroundTheme() Theme

func NewNoColorLightBackgroundTheme

func NewNoColorLightBackgroundTheme() Theme

func NewOrbTheme

func NewOrbTheme() Theme

func NewPinetreeTheme

func NewPinetreeTheme() Theme

func NewRedBlackTheme

func NewRedBlackTheme() Theme

func NewSynthwaveTheme

func NewSynthwaveTheme() Theme

func NewTealTheme

func NewTealTheme() Theme

func NewThemeFromBase16File

func NewThemeFromBase16File(filename string) (Theme, error)

NewThemeFromBase16File reads a base16 YAML scheme file and returns a fully populated Theme. It also registers the palette colors for syntax highlighting. Both the spec-0.11 format (with a "palette:" block) and the older flat format are supported.

func NewVSTrueColorTheme

func NewVSTrueColorTheme() Theme

NewVSTrueColorTheme creates a true-color VS Code–inspired light theme with a white background. Requires true-color or 256-color support.

func NewXoria16Theme

func NewXoria16Theme() Theme

func NewXoria256Theme

func NewXoria256Theme() Theme

NewXoria256Theme creates the Xoria256 theme, ported from the Vim color scheme by Dmitriy Y. Zotikov. Requires a terminal with 256-color or true-color support.

func NewZuluTheme

func NewZuluTheme() Theme

func (Theme) TextConfig

func (t Theme) TextConfig() *syntax.TextConfig

TextConfig returns a TextConfig struct that can be used for setting the syntax highlighting colors in the public DefaultTextConfig variable exported from the syntax package.

type ThemeInfo

type ThemeInfo struct {
	New               func() Theme // constructor
	Register          func()       // registers custom colors (call before New if NeedsRegistration)
	Name              string       // display name
	EnvValue          string       // O_THEME value (e.g., "synthwave", "gruvbox")
	Fallback16        string       // EnvValue of the 16-color fallback, if any
	NeedsRegistration bool         // requires Register() before use
	Needs256Colors    bool         // requires 256-color or true-color terminal
	Mono              bool         // monochrome theme (no syntax highlighting)
	Light             bool         // designed for light backgrounds
}

ThemeInfo holds metadata about a built-in theme, for use in menus and listings.

func BuiltinThemes

func BuiltinThemes() []ThemeInfo

BuiltinThemes returns all built-in themes in menu display order.

func ThemeByEnvValue

func ThemeByEnvValue(envValue string) (ThemeInfo, bool)

ThemeByEnvValue looks up a theme by its O_THEME value. Returns the ThemeInfo and true if found, or a zero value and false otherwise.

Jump to

Keyboard shortcuts

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