styling

package
v1.8.9 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HyphenHint = "Use a hyphen when typing a name with a space."

	// Brand colors - use these instead of hardcoding hex values
	PrimaryYellow = "#FFCC00" // Main accent color for borders, highlights
	LightYellow   = "#FFDE00" // Used in dark mode adaptive colors
	DarkYellow    = "#E1AD01" // Used in light mode adaptive colors
)

Variables

View Source
var (
	YellowColor     = lipgloss.Color(PrimaryYellow)
	YellowAdaptive  = lipgloss.AdaptiveColor{Light: DarkYellow, Dark: LightYellow}
	YellowAdaptive2 = lipgloss.AdaptiveColor{Light: DarkYellow, Dark: PrimaryYellow}
)

Pre-defined lipgloss colors for convenience

View Source
var (
	Green         = lipgloss.NewStyle().Foreground(lipgloss.Color("#38B000"))
	Red           = lipgloss.NewStyle().Foreground(lipgloss.Color("#D00000"))
	Gray          = lipgloss.Color("#777777")
	Yellow        = lipgloss.NewStyle().Foreground(YellowAdaptive)
	ColoredBullet = lipgloss.NewStyle().
					SetString("•").
					Foreground(YellowColor)
	CheckboxStyle = lipgloss.NewStyle().Foreground(YellowColor)
	KeyMenu       = lipgloss.NewStyle().Foreground(lipgloss.Color("#777777"))

	DocsLink = lipgloss.NewStyle().
				Foreground(YellowAdaptive2).
				Render("\x1b]8;;https://docs.poke-cli.com\x1b\\docs.poke-cli.com\x1b]8;;\x1b\\")

	StyleBold      = lipgloss.NewStyle().Bold(true)
	StyleItalic    = lipgloss.NewStyle().Italic(true)
	StyleUnderline = lipgloss.NewStyle().Underline(true)
	HelpBorder     = lipgloss.NewStyle().
					BorderStyle(lipgloss.RoundedBorder()).
					BorderForeground(YellowColor)
	ErrorColor  = lipgloss.NewStyle().Foreground(lipgloss.Color("#F2055C"))
	ErrorBorder = lipgloss.NewStyle().
				BorderStyle(lipgloss.RoundedBorder()).
				BorderForeground(lipgloss.Color("#F2055C"))
	WarningColor  = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF8C00"))
	WarningBorder = lipgloss.NewStyle().
					BorderStyle(lipgloss.RoundedBorder()).
					BorderForeground(lipgloss.Color("#FF8C00"))
	TypesTableBorder = lipgloss.NewStyle().
						BorderStyle(lipgloss.NormalBorder()).
						BorderForeground(YellowColor)
	ColorMap = map[string]string{
		"normal":   "#B7B7A9",
		"fire":     "#FF4422",
		"water":    "#3499FF",
		"electric": "#FFCC33",
		"grass":    "#77CC55",
		"ice":      "#66CCFF",
		"fighting": "#BB5544",
		"poison":   "#AA5699",
		"ground":   "#DEBB55",
		"flying":   "#889AFF",
		"psychic":  "#FF5599",
		"bug":      "#AABC22",
		"rock":     "#BBAA66",
		"ghost":    "#6666BB",
		"dragon":   "#7766EE",
		"dark":     "#775544",
		"steel":    "#AAAABB",
		"fairy":    "#EE99EE",
	}
)

Functions

func CapitalizeResourceName added in v1.8.5

func CapitalizeResourceName(name string) string

CapitalizeResourceName converts hyphenated resource names to title case Example: "strong-jaw" -> "Strong Jaw", "sword-of-ruin" -> "Sword of Ruin"

func FormTheme added in v1.5.0

func FormTheme() *huh.Theme

func GetTypeColor

func GetTypeColor(typeName string) string

GetTypeColor Helper function to get color for a given type name from colorMap

func StripANSI

func StripANSI(input string) string

StripANSI function is used in tests to strip ANSI for plain text processing

Types

type Color added in v1.0.3

type Color struct {
	R, G, B float64
}

Color To avoid unnecessary dependencies, I adapted the MakeColor function from "github.com/lucasb-eyer/go-colorful" and implemented it using only the standard library. Since I only needed this function, importing the entire library was unnecessary.

func MakeColor added in v1.0.3

func MakeColor(c color.Color) (Color, bool)

MakeColor constructs a Color from a color.Color.

func (Color) Hex added in v1.0.3

func (col Color) Hex() string

Hex returns the hex representation of the color, like "#ff0080".

func (Color) RGBA added in v1.0.3

func (col Color) RGBA() (uint32, uint32, uint32, uint32)

RGBA Implement the Go color.Color interface.

Jump to

Keyboard shortcuts

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