Gitfed
bastien-mrq/gitfed / cmd / gitfed-install / styles.go
package main

import "github.com/charmbracelet/lipgloss"

// Palette mirrors gitfed-web's own CSS tokens (cmd/gitfed-web/render.go)
// so the installer and the web UI it's about to stand up feel like the
// same product, not two unrelated tools.
var (
	colCanvas    = lipgloss.Color("#0d0f13")
	colSurface   = lipgloss.Color("#161a21")
	colBorder    = lipgloss.Color("#262c36")
	colText      = lipgloss.Color("#e8eaed")
	colTextDim   = lipgloss.Color("#9aa1ac")
	colTextFaint = lipgloss.Color("#6b7280")
	colAccent    = lipgloss.Color("#6c9df5")
	colOK        = lipgloss.Color("#7bd6a8")
	colWarn      = lipgloss.Color("#e0b34e")
	colDanger    = lipgloss.Color("#f28b82")
)

var (
	styleTitle = lipgloss.NewStyle().Bold(true).Foreground(colText)
	styleTag   = lipgloss.NewStyle().Foreground(colTextFaint).Border(lipgloss.RoundedBorder()).
			BorderForeground(colBorder).Padding(0, 1)
	styleBody   = lipgloss.NewStyle().Foreground(colTextDim)
	styleMuted  = lipgloss.NewStyle().Foreground(colTextFaint)
	styleAccent = lipgloss.NewStyle().Foreground(colAccent)
	styleBold   = lipgloss.NewStyle().Bold(true).Foreground(colText)

	styleOK     = lipgloss.NewStyle().Foreground(colOK).Bold(true)
	styleWarn   = lipgloss.NewStyle().Foreground(colWarn).Bold(true)
	styleDanger = lipgloss.NewStyle().Foreground(colDanger).Bold(true)

	stylePanel = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).
			BorderForeground(colBorder).Padding(0, 2).Foreground(colText)
	stylePanelDanger = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).
				BorderForeground(colDanger).Padding(0, 2).Foreground(colText)

	styleLog = lipgloss.NewStyle().Foreground(colTextDim).Border(lipgloss.NormalBorder()).
			BorderForeground(colBorder).Padding(0, 1)

	styleBtn = lipgloss.NewStyle().Foreground(colText).Background(colSurface).
			Padding(0, 2).MarginRight(1)
	styleBtnActive = lipgloss.NewStyle().Foreground(colCanvas).Background(colAccent).
			Bold(true).Padding(0, 2).MarginRight(1)
	styleBtnGhost = lipgloss.NewStyle().Foreground(colTextFaint).Padding(0, 2).MarginRight(1)

	styleInputLabel = lipgloss.NewStyle().Foreground(colTextFaint)
	styleHint       = lipgloss.NewStyle().Foreground(colTextFaint).Italic(true)

	styleFooter = lipgloss.NewStyle().Foreground(colTextFaint)
)

func glyph(status checkStatus) string {
	switch status {
	case statusOK:
		return styleOK.Render("✓")
	case statusWarn:
		return styleWarn.Render("!")
	default:
		return styleMuted.Render("○")
	}
}