stylex

package
v1.17.0 Latest Latest
Warning

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

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

Documentation

Overview

Package stylex provides styles for the tools commands. This is a separate package to avoid import cycles between the tools commands.

It defines a bunch of lipgloss styles that can be used across the tools commands to ensure a consistent look and feel. It will automatically disable styling if the output is not a TTY, so that the tools can be used in scripts without worrying about ANSI escape codes.

You have nothing to do to activate that.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Styling for output - colors only enabled if terminal is TTY
	IsTTY = isatty.IsTerminal(os.Stdout.Fd())

	TitleStyle  = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("12"))
	HeaderStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("14"))
	NoteStyle   = lipgloss.NewStyle().Foreground(lipgloss.Color("238")).Italic(true)
	DimStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("240"))

	LabelStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("245"))
	ValueStyle = lipgloss.NewStyle().Bold(true)

	SuccessStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("10"))  // Green
	WarnStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("208")) // Orange
	ErrorStyle   = lipgloss.NewStyle().Foreground(lipgloss.Color("9"))   // Red

	ConnectionActiveStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("11")) // Yellow
	ConnectionClosedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("10")) // Green
	ConnectionOrphanStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("13")) // Magenta
	ConnectionErrorStyle  = ErrorStyle

	// Styles used when rendering raw log lines, kept desaturated so long log
	// dumps stay easy on the eyes
	LogLoggerStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("73"))             // Cadet teal
	LogKeyStyle    = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("252")) // Off-white, emphasized
	LogValueStyle  = lipgloss.NewStyle().Foreground(lipgloss.Color("245"))            // Grey

)

Functions

func ConnectionActive

func ConnectionActive(str string) string

ConnectionActive is a helper function equivalent to ConnectionActive.Render(...)

func ConnectionActivef

func ConnectionActivef(format string, a ...any) string

ConnectionActivef is a helper function equivalent to ConnectionActive.Render(fmt.Sprintf(...))

func ConnectionClosed

func ConnectionClosed(str string) string

ConnectionClosed is a helper function equivalent to ConnectionClosed.Render(...)

func ConnectionClosedf

func ConnectionClosedf(format string, a ...any) string

ConnectionClosedf is a helper function equivalent to ConnectionClosed.Render(fmt.Sprintf(...))

func ConnectionError

func ConnectionError(str string) string

ConnectionError is a helper function equivalent to ConnectionError.Render(...)

func ConnectionErrorf

func ConnectionErrorf(format string, a ...any) string

ConnectionErrorf is a helper function equivalent to ConnectionError.Render(fmt.Sprintf(...))

func ConnectionOrphan

func ConnectionOrphan(str string) string

ConnectionOrphan is a helper function equivalent to ConnectionOrphan.Render(...)

func ConnectionOrphanf

func ConnectionOrphanf(format string, a ...any) string

ConnectionOrphanf is a helper function equivalent to ConnectionOrphan.Render(fmt.Sprintf(...))

func Dim

func Dim(str string) string

Dim is a helper function equivalent to Dim.Render(...)

func Dimf

func Dimf(format string, a ...any) string

Dimf is a helper function equivalent to Dim.Render(fmt.Sprintf(...))

func DisableColors

func DisableColors()

func Error

func Error(str string) string

Error is a helper function equivalent to Error.Render(...)

func Errorf

func Errorf(format string, a ...any) string

Errorf is a helper function equivalent to Error.Render(fmt.Sprintf(...))

func Header(str string) string

Header is a helper function equivalent to Header.Render(...)

func Headerf

func Headerf(format string, a ...any) string

Headerf is a helper function equivalent to Header.Render(fmt.Sprintf(...))

func Label

func Label(str string) string

Label is a helper function equivalent to Label.Render(...)

func Labelf

func Labelf(format string, a ...any) string

Labelf is a helper function equivalent to Label.Render(fmt.Sprintf(...))

func LogKey added in v1.16.1

func LogKey(str string) string

LogKey is a helper function equivalent to LogKey.Render(...)

func LogKeyf added in v1.16.1

func LogKeyf(format string, a ...any) string

LogKeyf is a helper function equivalent to LogKey.Render(fmt.Sprintf(...))

func LogLogger added in v1.16.1

func LogLogger(str string) string

LogLogger is a helper function equivalent to LogLogger.Render(...)

func LogLoggerf added in v1.16.1

func LogLoggerf(format string, a ...any) string

LogLoggerf is a helper function equivalent to LogLogger.Render(fmt.Sprintf(...))

func LogValue added in v1.16.1

func LogValue(str string) string

LogValue is a helper function equivalent to LogValue.Render(...)

func LogValuef added in v1.16.1

func LogValuef(format string, a ...any) string

LogValuef is a helper function equivalent to LogValue.Render(fmt.Sprintf(...))

func Note

func Note(str string) string

Note is a helper function equivalent to Note.Render(...)

func Notef

func Notef(format string, a ...any) string

Notef is a helper function equivalent to Note.Render(fmt.Sprintf(...))

func Separator

func Separator(count int) string

func Success

func Success(str string) string

Success is a helper function equivalent to Success.Render(...)

func Successf

func Successf(format string, a ...any) string

Successf is a helper function equivalent to Success.Render(fmt.Sprintf(...))

func Title

func Title(str string) string

Title is a helper function equivalent to Title.Render(...)

func Titlef

func Titlef(format string, a ...any) string

Titlef is a helper function equivalent to Title.Render(fmt.Sprintf(...))

func Value

func Value(str string) string

Value is a helper function equivalent to Value.Render(...)

func Valuef

func Valuef(format string, a ...any) string

Valuef is a helper function equivalent to Value.Render(fmt.Sprintf(...))

func Warn

func Warn(str string) string

Warn is a helper function equivalent to Warn.Render(...)

func Warnf

func Warnf(format string, a ...any) string

Warnf is a helper function equivalent to Warn.Render(fmt.Sprintf(...))

Types

This section is empty.

Jump to

Keyboard shortcuts

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