style

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package style provides consistent terminal styling for deco CLI output.

Index

Constants

View Source
const (
	SymbolSuccess = "✓"
	SymbolError   = "✗"
	SymbolWarning = "!"
	SymbolInfo    = "•"
	SymbolArrow   = "→"
	SymbolBullet  = "•"
)

Symbols for consistent iconography

Variables

View Source
var (

	// Semantic styles
	Error   = color.New(color.FgRed, color.Bold)
	Warning = color.New(color.FgYellow)
	Success = color.New(color.FgGreen)
	Info    = color.New(color.FgCyan)
	Header  = color.New(color.Bold)
	Muted   = color.New(color.FgHiBlack)
	Code    = color.New(color.FgMagenta)

	// Severity colors
	Critical = color.New(color.FgRed, color.Bold)
	High     = color.New(color.FgRed)
	Medium   = color.New(color.FgYellow)
	Low      = color.New(color.FgBlue)

	// Status colors
	StatusDraft    = color.New(color.FgYellow)
	StatusReview   = color.New(color.FgCyan)
	StatusApproved = color.New(color.FgGreen)
	StatusArchived = color.New(color.FgHiBlack)
)

Functions

func ErrorIcon

func ErrorIcon() string

ErrorIcon returns a styled error symbol

func Fmt

func Fmt(c *color.Color, format string, args ...interface{}) string

Fmt returns a styled string using the given color

func Init

func Init()

Init initializes the style system. Call this early in main.

func IsEnabled

func IsEnabled() bool

IsEnabled returns whether colors are currently enabled

func SetMode

func SetMode(m ColorMode)

SetMode sets the global color mode

func SeverityColor

func SeverityColor(severity string) *color.Color

SeverityColor returns the color for a severity level

func StatusColor

func StatusColor(status string) *color.Color

StatusColor returns the color for a status

func SuccessIcon

func SuccessIcon() string

SuccessIcon returns a styled success symbol

func WarningIcon

func WarningIcon() string

WarningIcon returns a styled warning symbol

Types

type ColorMode

type ColorMode int

ColorMode controls when colors are used

const (
	ColorAuto   ColorMode = iota // Auto-detect TTY
	ColorAlways                  // Always use colors
	ColorNever                   // Never use colors
)

func GetMode

func GetMode() ColorMode

GetMode returns the current color mode

func ParseColorMode

func ParseColorMode(s string) ColorMode

ParseColorMode parses a color mode string (auto, always, never)

Jump to

Keyboard shortcuts

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