theme

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 3 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

Overview

Package theme builds ZPad's palettes for the native UI and the editor.

Index

Constants

View Source
const (
	SystemID = "system"
	LightID  = "light"
	DarkID   = "dark"
)

Theme ids of the default pair and of following the desktop.

Variables

This section is empty.

Functions

func ActiveTab

func ActiveTab(t *ui.Theme) ui.Color

ActiveTab is the chosen tab's background.

func Dark

func Dark() *ui.Theme

Dark returns the dark palette.

func EditorTheme

func EditorTheme(t *ui.Theme) *editor.Theme

EditorTheme colors the code editor to match t.

func FileTree

func FileTree(t *ui.Theme) *ui.Theme

FileTree returns the palette of the sidebar's tree: the chosen row is a faint, full-width wash rather than a filled accent, as VS Code's and Zed's file trees, and its text keeps the normal color.

func For

func For(dark bool) *ui.Theme

For returns the palette for an appearance.

func Inverse

func Inverse(t *ui.Theme) (fill, text ui.Color)

Inverse is the fill of a tip and the color of text on it, as MyGo's own tooltip and toast choose them: the theme's Inverse and InverseText where it sets them, the text on the background otherwise. A tip that MyGo cannot place shares the look of the ones it can.

func Light

func Light() *ui.Theme

Light returns the light palette.

func Normalize added in v0.5.0

func Normalize(id string) string

Normalize returns id when it names a theme, the system setting for anything else, so that a settings file written by hand cannot leave the app with no palette.

func ResultList added in v0.4.0

func ResultList(t *ui.Theme) *ui.Theme

ResultList returns the palette of the search results: the chosen row is a faint wash too, so the highlight of the match inside it stays visible.

func Sidebar(t *ui.Theme) ui.Color

Sidebar is the sidebar's background.

func TabBar

func TabBar(t *ui.Theme) ui.Color

TabBar is the tab bar's background.

Types

type Chrome added in v0.5.0

type Chrome struct {
	Sidebar   ui.Color
	TabBar    ui.Color
	ActiveTab ui.Color
}

Chrome is the palette of the window parts ui.Theme does not color.

type Definition added in v0.5.0

type Definition struct {
	ID         string
	Name       string
	Dark       bool
	UI         *ui.Theme
	FileTree   *ui.Theme
	ResultList *ui.Theme
	// Chrome colors the sidebar, the tab bar and the chosen tab.
	Chrome Chrome
	Code   *editor.Theme
}

Definition is one selectable theme: the UI palette, the colors of the window parts that ui.Theme has no fields for, and the editor's palette. The default light and dark themes keep the colors they always had; the named themes are built from a handful of seed colors.

func Default added in v0.5.0

func Default(dark bool) *Definition

Default returns the default theme for an appearance.

func Lookup added in v0.5.0

func Lookup(id string) (*Definition, bool)

Lookup returns the theme with id, including the default light and dark themes, or false when no such theme exists.

func Named added in v0.5.0

func Named() []*Definition

Named returns the named themes in display order, default light and dark excluded.

func Resolve added in v0.5.0

func Resolve(id string, systemDark bool) *Definition

Resolve returns the theme a setting stands for: the named one when it exists, the default theme for an appearance otherwise (also for "system"), or the default light theme for an unknown id.

Jump to

Keyboard shortcuts

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