palette

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 6 Imported by: ? 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 palette is the single source of truth for NextDeploy's terminal colours. The values mirror the website palette in frontend/app/brand.css: warm graphite with an amber "phosphor terminal" accent and sage for success. Keep the two in sync when either changes.

Codes are computed at call time from the environment:

  • NO_COLOR (any non-empty value) disables every code, Bold and Reset included.
  • FORCE_COLOR (non-empty, not "0") enables codes even when stderr isn't a terminal.
  • Otherwise codes are only emitted when stderr is a terminal, so logs piped to a file, CI, or an AI agent stay plain text.
  • COLORTERM=truecolor|24bit selects 24-bit escapes (\033[38;2;R;G;Bm); otherwise the 256-colour fallback (\033[38;5;Nm) is used.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Amber is the primary accent: titles, commands, highlights, [APP].
	Amber = Color{255, 182, 39, 214}
	// Sage is success, "ok", hints and fixes.
	Sage = Color{139, 175, 108, 107}
	// Warn is for warnings.
	Warn = Color{232, 131, 58, 208}
	// Error is for errors and failures.
	Error = Color{229, 83, 75, 167}
	// Muted is for timestamps, dim labels and separators.
	Muted = Color{154, 147, 132, 246}
	// Sand is secondary info, e.g. [PLATFORM] and the info log level.
	Sand = Color{217, 212, 199, 188}
	// Dim is a darker muted tone used for trace-level output.
	Dim = Color{88, 88, 88, 240}
)

Functions

func Bold

func Bold() string

Bold returns the bold escape, or "" when NO_COLOR is set.

func Enabled

func Enabled() bool

Enabled reports whether colour output is allowed: NO_COLOR is unset, and either FORCE_COLOR is set or stderr is a terminal.

func Reset

func Reset() string

Reset returns the reset escape, or "" when NO_COLOR is set.

func Truecolor

func Truecolor() bool

Truecolor reports whether the terminal advertises 24-bit colour support.

func Underline

func Underline() string

Underline returns the underline escape, or "" when NO_COLOR is set.

Types

type Color

type Color struct {
	R, G, B uint8
	Index   uint8 // xterm 256-colour fallback
}

Color is a palette entry with a truecolor value and a 256-colour fallback.

func (Color) Attrs

func (c Color) Attrs(extra ...color.Attribute) []color.Attribute

Attrs returns fatih/color attributes for c's foreground, followed by extra. fatih joins attributes with ';', so the result renders as 38;5;N or 38;2;R;G;B. fatih itself handles NO_COLOR and non-TTY output, so these attributes are returned regardless of NO_COLOR.

func (Color) BG

func (c Color) BG() string

BG returns the background escape sequence for c, or "" when NO_COLOR is set.

func (Color) BoldFG

func (c Color) BoldFG() string

BoldFG returns Bold followed by the foreground sequence for c.

func (Color) FG

func (c Color) FG() string

FG returns the foreground escape sequence for c, or "" when NO_COLOR is set.

func (Color) New

func (c Color) New(extra ...color.Attribute) *color.Color

New returns a *color.Color using c's foreground plus any extra attributes.

func (Color) Wrap

func (c Color) Wrap(s string) string

Wrap returns s coloured with c and terminated by Reset.

Jump to

Keyboard shortcuts

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