styling

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

	StyleBold      = lipgloss.NewStyle().Bold(true)
	StyleItalic    = lipgloss.NewStyle().Italic(true)
	StyleUnderline = lipgloss.NewStyle().Underline(true)
	HelpBorder     = lipgloss.NewStyle().
					BorderStyle(lipgloss.RoundedBorder()).
					BorderForeground(lipgloss.Color("#FFCC00"))
	ErrorColor  = lipgloss.NewStyle().Foreground(lipgloss.Color("#F2055C"))
	ErrorBorder = lipgloss.NewStyle().
				BorderStyle(lipgloss.RoundedBorder()).
				BorderForeground(lipgloss.Color("#F2055C"))
	TypesTableBorder = lipgloss.NewStyle().
						BorderStyle(lipgloss.NormalBorder()).
						BorderForeground(lipgloss.Color("#FFCC00"))
	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 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
}

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)

Implement the Go color.Color interface.

Jump to

Keyboard shortcuts

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