styles

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ANSIPrefix

func ANSIPrefix(st lipgloss.Style) []byte

ANSIPrefix returns the ANSI prefix for the given style.

func ColorDisabled

func ColorDisabled() bool

ColorDisabled returns true if colored output should be disabled. This function is not responsible for determining if output is a TTY. Callers should perform their own check and call DisableStyles if needed.

func ColorForced

func ColorForced() bool

ColorForced returns true if colored output should be forced.

func DisableStyles

func DisableStyles()

DisableStyles disables ANSI styling by switching to an ASCII color profile. Should only be useful when the environment should allow colored output, but you want it to be explicitly disabled (i.e. if the output is not a TTY or if the user has explicitly disabled it).

func EnableStyles

func EnableStyles()

EnableStyles enables ANSI styling by switching to a TrueColor color profile. Should only be used when the user explicitly forces color output.

func NewStyle

func NewStyle(color Color) lipgloss.Style

NewStyle returns a new style with the given foreground color.

func TemporarilyDisableStyles

func TemporarilyDisableStyles() func()

TemporarilyDisableStyles temporarily disables ANSI styling by switching to an ASCII color profile. Callers must defer the returned function to restore the original color profile.

Types

type CensysColorScheme added in v0.1.0

type CensysColorScheme struct{}

func (CensysColorScheme) Comment added in v0.1.0

func (c CensysColorScheme) Comment() Color

func (CensysColorScheme) Danger added in v0.1.0

func (c CensysColorScheme) Danger() Color

func (CensysColorScheme) Info added in v0.1.0

func (c CensysColorScheme) Info() Color

func (CensysColorScheme) Primary added in v0.1.0

func (c CensysColorScheme) Primary() Color

func (CensysColorScheme) Secondary added in v0.1.0

func (c CensysColorScheme) Secondary() Color

func (CensysColorScheme) Signature added in v0.1.0

func (c CensysColorScheme) Signature() Color

func (CensysColorScheme) Tertiary added in v0.1.0

func (c CensysColorScheme) Tertiary() Color

func (CensysColorScheme) Warning added in v0.1.0

func (c CensysColorScheme) Warning() Color

type Color

type Color = lipgloss.AdaptiveColor
var (
	ColorOrange   Color
	ColorOffWhite Color
	ColorSage     Color
	ColorTeal     Color
	ColorAqua     Color
	ColorGold     Color
	ColorRed      Color
	ColorGray     Color

	// Additional basic colors
	ColorBlack = Color{Light: "#000000", Dark: "#000000"}
	ColorBlue  = Color{Light: "#3BBFDE", Dark: "#3BBFDE"}
)

Color variables initialized from the active color scheme. These can be used throughout the codebase.

type ColorScheme added in v0.1.0

type ColorScheme interface {
	// Signature color is used for branding and signatures
	Signature() lipgloss.AdaptiveColor
	// Primary color is used for main content
	Primary() lipgloss.AdaptiveColor
	// Secondary color is used for supporting content
	Secondary() lipgloss.AdaptiveColor
	// Tertiary color is used for additional accents
	Tertiary() lipgloss.AdaptiveColor
	// Info color is used for informational messages
	Info() lipgloss.AdaptiveColor
	// Warning color is used for warning messages
	Warning() lipgloss.AdaptiveColor
	// Danger color is used for error messages
	Danger() lipgloss.AdaptiveColor
	// Comment color is used for less important text
	Comment() lipgloss.AdaptiveColor
}

ColorScheme defines the interface for providing colors to the CLI.

func DefaultColorScheme added in v0.1.0

func DefaultColorScheme() ColorScheme

DefaultColorScheme returns the default Censys-themed color scheme. To use a custom color scheme, replace DefaultColorScheme() with your own implementation.

type Styles

type Styles struct {
	Signature lipgloss.Style
	Primary   lipgloss.Style
	Secondary lipgloss.Style
	Tertiary  lipgloss.Style
	Info      lipgloss.Style
	Warning   lipgloss.Style
	Danger    lipgloss.Style
	Comment   lipgloss.Style
	Indent4   lipgloss.Style
	Indent8   lipgloss.Style
}

Styles describes the color palette and layout styles used by the CLI. These styles are consumed by formatter and command help rendering.

var GlobalStyles *Styles

GlobalStyles is the default palette used across CLI output. It is initialized during package init and can be overridden in tests.

func NewStyles added in v0.1.0

func NewStyles(scheme ColorScheme) *Styles

NewStyles creates a new Styles instance from a ColorScheme.

Jump to

Keyboard shortcuts

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