styles

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package styles provides minimal ANSI styling helpers for CLI output.

This package defines colors and text styles used throughout Ralph's console output. It uses raw ANSI escape codes (truecolor / 24-bit) to avoid pulling in a styling library.

Colors are chosen automatically based on the terminal background. Detection uses the COLORFGBG environment variable (set by most terminals). When that is absent the dark-background palette is used as the default.

Index

Constants

View Source
const RalphFox = `` /* 1159-byte string literal not displayed */

RalphFox is ASCII art of Ralph the blue fox shown at CLI startup.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color added in v0.2.0

type Color string

Color is a truecolor (24-bit) ANSI SGR fragment, e.g. "38;2;255;28;240".

var (
	// Primary colors
	Primary Color
	Success Color
	Warning Color
	Error   Color
	Info    Color
)

Color palette — populated in init based on background detection.

type Style added in v0.2.0

type Style struct {
	// contains filtered or unexported fields
}

Style applies a sequence of ANSI SGR codes around a string.

var (
	// SubTitleStyle for primary text.
	SubTitleStyle Style
	// InfoStyle for informational messages.
	InfoStyle Style
	// SuccessStyle for success messages.
	SuccessStyle Style
	// WarningStyle for warning messages.
	WarningStyle Style
	// ErrorStyle for error messages.
	ErrorStyle Style
)

Message styles

var (
	// TitleStyle is for main screen titles (bold + primary color).
	TitleStyle Style
)

Title styles

func (Style) Render added in v0.2.0

func (s Style) Render(text string) string

Render wraps text with this style's ANSI codes and a reset.

Jump to

Keyboard shortcuts

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