theme

package
v1.0.0-rc.17 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 4 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 is the color vocabulary the UI draws with. A Theme names colors by role, the same roles the web client's DaisyUI theme block declares (base, primary, secondary, accent, neutral, info, success, warning, error, plus the chat-specific username), so a theme ported from the site's CSS is a copy of numbers, not a redesign. Widgets ask for a role, never a color, which is what lets a second theme exist without touching them (ADR 0005).

Colors are exact sRGB; Bubble Tea's renderer downsamples them to the terminal's profile and drops them under NO_COLOR. The one profile where that goes wrong is ANSI-16, so ForProfile swaps in hand-picked palette slots there.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Names

func Names() []string

Names lists the built-in themes, sorted, for help text and errors.

Types

type Theme

type Theme struct {
	Name string
	// Light marks a theme tuned for light terminal backgrounds. Since
	// the chat screen draws every role on the terminal's own background,
	// this is what a theme is for, more than its Base100 is; it also
	// picks which 16-color palette ForProfile swaps in.
	Light bool

	// Base100 is the app background, Base200 panels, Base300 borders and
	// hover. The terminal keeps its own background (see ADR 0005), so
	// Base100 is what the splash paints and what text roles are tuned
	// against, not what the chat screen fills.
	Base100, Base200, Base300 color.Color
	// BaseContent is body text on the base surfaces.
	BaseContent color.Color

	// Primary is the brand color; PrimaryContent is text on it. The
	// status bar is primary on primary-content, and the splash wordmark
	// is drawn in primary.
	Primary, PrimaryContent color.Color
	// Secondary is the second warm tone; on the site it carries links,
	// MOTD framing and mod names.
	Secondary, SecondaryContent color.Color
	// Accent is the loud one, reserved for what must stand out: DMs.
	Accent, AccentContent color.Color
	// Neutral is chrome that is neither surface nor brand.
	Neutral, NeutralContent color.Color

	Info, InfoContent       color.Color
	Success, SuccessContent color.Color
	Warning, WarningContent color.Color
	Error, ErrorContent     color.Color

	// Username colors ordinary speakers. The site keeps it outside the
	// DaisyUI block because DaisyUI has no such role; it is a role here
	// because most of the transcript is names and they must not read as
	// the loud brand color.
	Username color.Color
}

Theme is one named palette. Every field is set for every built-in theme; a widget may rely on that.

func Default

func Default() Theme

Default is the theme used when none is asked for: the site's own.

func DefaultLight

func DefaultLight() Theme

DefaultLight is the theme used when none is asked for and the terminal reports a light background: the site's brand, darkened to read on it.

func Lookup

func Lookup(name string) (Theme, bool)

Lookup finds a built-in theme by name. The name is what NGCHAT_THEME carries, so an unknown one is the caller's error to report with Names, not something to fall back from silently.

func (Theme) ForProfile

func (t Theme) ForProfile(p colorprofile.Profile) Theme

ForProfile is t as it should be drawn on a terminal with profile p. Every profile but ANSI gets t unchanged, since the renderer's own downsampling to 256 colors keeps the roles apart. ANSI gets the shared 16-color palette for t's kind (ansi16, or ansi16Light for a Light theme), keeping t's name and Light. p must be the profile the program renders with, which Bubble Tea detects from its output and environment the same way colorprofile.Detect does.

Jump to

Keyboard shortcuts

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