Documentation ¶
Overview ¶
Package style provides a shell script interface for Lip Gloss. https://github.com/charmbracelet/lipgloss
It allows you to use Lip Gloss to style text without needing to use Go. All of the styling options are available as flags.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Border map[string]lipgloss.Border = map[string]lipgloss.Border{ "double": lipgloss.DoubleBorder(), "hidden": lipgloss.HiddenBorder(), "none": {}, "normal": lipgloss.NormalBorder(), "rounded": lipgloss.RoundedBorder(), "thick": lipgloss.ThickBorder(), }
Border maps strings to `lipgloss.Border`s.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { Text []string `arg:"" optional:"" help:"Text to which to apply the style"` Style StylesNotHidden `embed:""` }
Options is the customization options for the style command.
func (Options) Run ¶
Run provides a shell script interface for the Lip Gloss styling. https://github.com/charmbracelet/lipgloss
type Styles ¶
type Styles struct { // Colors Foreground string `help:"Foreground Color" default:"${defaultForeground}" group:"Style Flags" env:"FOREGROUND"` Background string `help:"Background Color" default:"${defaultBackground}" group:"Style Flags" env:"BACKGROUND" hidden:"true"` // Border Border string `` /* 140-byte string literal not displayed */ BorderBackground string `help:"Border Background Color" group:"Style Flags" default:"${defaultBorderBackground}" env:"BORDER_BACKGROUND" hidden:"true"` BorderForeground string `help:"Border Foreground Color" group:"Style Flags" default:"${defaultBorderForeground}" env:"BORDER_FOREGROUND" hidden:"true"` // Layout Align string `` /* 136-byte string literal not displayed */ Height int `help:"Text height" default:"${defaultHeight}" group:"Style Flags" env:"HEIGHT" hidden:"true"` Width int `help:"Text width" default:"${defaultWidth}" group:"Style Flags" env:"WIDTH" hidden:"true"` Margin string `help:"Text margin" default:"${defaultMargin}" group:"Style Flags" env:"MARGIN" hidden:"true"` Padding string `help:"Text padding" default:"${defaultPadding}" group:"Style Flags" env:"PADDING" hidden:"true"` // Format Bold bool `help:"Bold text" default:"${defaultBold}" group:"Style Flags" env:"BOLD" hidden:"true"` Faint bool `help:"Faint text" default:"${defaultFaint}" group:"Style Flags" env:"FAINT" hidden:"true"` Italic bool `help:"Italicize text" default:"${defaultItalic}" group:"Style Flags" env:"ITALIC" hidden:"true"` Strikethrough bool `help:"Strikethrough text" default:"${defaultStrikethrough}" group:"Style Flags" env:"STRIKETHROUGH" hidden:"true"` Underline bool `help:"Underline text" default:"${defaultUnderline}" group:"Style Flags" env:"UNDERLINE" hidden:"true"` }
Styles is a flag set of possible styles.
It corresponds to the available options in the lipgloss.Style struct.
This flag set is used in other parts of the application to embed styles for components, through embedding and prefixing.
func (Styles) ToLipgloss ¶
ToLipgloss takes a Styles flag set and returns the corresponding lipgloss.Style.
type StylesNotHidden ¶ added in v0.13.0
type StylesNotHidden struct { // Colors Foreground string `help:"Foreground Color" default:"${defaultForeground}" group:"Style Flags" env:"FOREGROUND"` Background string `help:"Background Color" default:"${defaultBackground}" group:"Style Flags" env:"BACKGROUND"` // Border Border string `` /* 126-byte string literal not displayed */ BorderBackground string `help:"Border Background Color" group:"Style Flags" default:"${defaultBorderBackground}" env:"BORDER_BACKGROUND"` BorderForeground string `help:"Border Foreground Color" group:"Style Flags" default:"${defaultBorderForeground}" env:"BORDER_FOREGROUND"` // Layout Align string `help:"Text Alignment" enum:"left,center,right,bottom,middle,top" default:"${defaultAlign}" group:"Style Flags" env:"ALIGN"` Height int `help:"Text height" default:"${defaultHeight}" group:"Style Flags" env:"HEIGHT"` Width int `help:"Text width" default:"${defaultWidth}" group:"Style Flags" env:"WIDTH"` Margin string `help:"Text margin" default:"${defaultMargin}" group:"Style Flags" env:"MARGIN"` Padding string `help:"Text padding" default:"${defaultPadding}" group:"Style Flags" env:"PADDING"` // Format Bold bool `help:"Bold text" default:"${defaultBold}" group:"Style Flags" env:"BOLD"` Faint bool `help:"Faint text" default:"${defaultFaint}" group:"Style Flags" env:"FAINT"` Italic bool `help:"Italicize text" default:"${defaultItalic}" group:"Style Flags" env:"ITALIC"` Strikethrough bool `help:"Strikethrough text" default:"${defaultStrikethrough}" group:"Style Flags" env:"STRIKETHROUGH"` Underline bool `help:"Underline text" default:"${defaultUnderline}" group:"Style Flags" env:"UNDERLINE"` }
StylesNotHidden allows the style struct to display full help when not-embedded.
NB: We must duplicate this struct to ensure that `gum style` does not hide flags when an error pops up. Ideally, we can dynamically hide or show flags based on the command run: https://github.com/alecthomas/kong/issues/316
func (StylesNotHidden) ToLipgloss ¶ added in v0.13.0
func (s StylesNotHidden) ToLipgloss() lipgloss.Style
ToLipgloss takes a Styles flag set and returns the corresponding lipgloss.Style.