render

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ActivePalette = DefaultPalette

	DefaultPalette = Palette{
		TextPrimary:  lipgloss.Color("014"),
		TextMuted:    lipgloss.Color("008"),
		TextInverted: lipgloss.Color("005"),

		Surface:      lipgloss.Color("240"),
		SurfaceAlt:   lipgloss.Color("008"),
		SurfaceHover: lipgloss.Color("007"),

		Accent:      lipgloss.Color("003"),
		AccentMuted: lipgloss.Color("012"),

		Success: lipgloss.Color("010"),
		Warning: lipgloss.Color("011"),
		Error:   lipgloss.Color("009"),

		Border: lipgloss.Color("015"),
	}
)
View Source
var (
	InfoCodeStyle = codeStyle.
					Foreground(ActivePalette.TextPrimary).
					Render

	InfoMsgStyle = lipgloss.NewStyle().
					Foreground(ActivePalette.TextPrimary).
					Render

	SuccessCodeStyle = codeStyle.
						Foreground(ActivePalette.Success).
						Render

	SuccessMsgStyle = lipgloss.NewStyle().
					Foreground(ActivePalette.TextPrimary).
					Render

	WarnCodeStyle = codeStyle.
					Foreground(ActivePalette.Warning).
					Render

	WarnMsgStyle = lipgloss.NewStyle().
					Foreground(ActivePalette.TextPrimary).
					Render

	ErrCodeStyle = codeStyle.
					Foreground(ActivePalette.Error).
					Render

	ErrMsgStyle = lipgloss.NewStyle().
				Foreground(ActivePalette.Accent).
				Render

	TitleStyle = lipgloss.NewStyle().
				Width(80).
				Align(lipgloss.Center).
				Margin(1, 0).
				Bold(true).
				Foreground(ActivePalette.Accent).
				Background(ActivePalette.SurfaceAlt).
				Render

	HelpStyle = lipgloss.NewStyle().
				Foreground(ActivePalette.TextMuted).
				Render

	DateStyle = lipgloss.NewStyle().
				Width(25).
				Foreground(ActivePalette.TextMuted).
				Render

	SizeStyle = lipgloss.NewStyle().
				Width(20).
				Foreground(ActivePalette.AccentMuted).
				Render

	DirStyle = lipgloss.NewStyle().
				Width(60).
				Foreground(ActivePalette.Accent).
				Render

	FileStyle = lipgloss.NewStyle().
				Width(60).
				Foreground(ActivePalette.TextPrimary).
				Render
)

Functions

func Box

func Box(lines ...string) string

func Bucket

func Bucket(bucket types.Bucket) string

func CommonPrefix

func CommonPrefix(commonPrefix types.CommonPrefix) string

func Date

func Date(date time.Time) string

func Error

func Error(err error) string

func HttpStatus

func HttpStatus(code int, msg string) string

func HttpStatusOrError

func HttpStatusOrError(code int, err error) string

func Object

func Object(object types.Object) string

func SupportsBox

func SupportsBox() bool

func Swatch

func Swatch(label string, fg, bg *lipgloss.Color) string

func Title

func Title(title string) string

Types

type Meta

type Meta struct {
	Value  any
	Format func() string
}

func NewDate

func NewDate(value time.Time) Meta

func NewNumber

func NewNumber[T Number](value T) Meta

func NewSize

func NewSize(value int64) Meta

func NewString

func NewString(value string) Meta

type Metadata

type Metadata map[string]Meta

func (Metadata) Render

func (metadata Metadata) Render() string

type Number

type Number interface {
	~float32 | ~float64 |
		~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

type Palette

type Palette struct {
	TextPrimary  lipgloss.Color
	TextMuted    lipgloss.Color
	TextInverted lipgloss.Color

	Surface      lipgloss.Color
	SurfaceAlt   lipgloss.Color
	SurfaceHover lipgloss.Color

	Accent      lipgloss.Color
	AccentMuted lipgloss.Color

	Success lipgloss.Color
	Warning lipgloss.Color
	Error   lipgloss.Color

	Border lipgloss.Color
}

func (*Palette) Render

func (p *Palette) Render() string

Jump to

Keyboard shortcuts

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