style

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 8 Imported by: 20

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

This section is empty.

Functions

func HideFlags

func HideFlags(ctx *kong.Context)

HideFlags hides the flags from the usage output. This is used in conjunction with BeforeReset hook.

Types

type Options

type Options struct {
	Text  []string `arg:"" optional:"" help:"Text to which to apply the style"`
	Style Styles   `embed:""`
}

Options is the customization options for the style command.

func (Options) Run

func (o Options) Run() error

Run provides a shell script interface for the Lip Gloss styling. https://github.com/charmbracelet/lipgloss

type Styles

type Styles struct {
	// Colors
	Background string `help:"Background Color" default:"${defaultBackground}" group:"Style Flags" env:"BACKGROUND"`
	Foreground string `help:"Foreground Color" default:"${defaultForeground}" group:"Style Flags" env:"FOREGROUND"`

	// 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"`
}

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

func (s Styles) ToLipgloss() lipgloss.Style

ToLipgloss takes a Styles flag set and returns the corresponding lipgloss.Style.

Jump to

Keyboard shortcuts

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