charm

package
v1.93.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Colors contains the default doctl color scheme.

View Source
var (
	// ErrCanceled represents a user-initiated cancellation.
	ErrCanceled = fmt.Errorf("canceled")
)

Functions

func Factory

func Factory[T any](x T) func() T

func Indent

func Indent(level uint) io.Writer

func IndentString

func IndentString(level uint, str string) string

func IndentWriter

func IndentWriter(w io.Writer, level uint) io.Writer

func SnakeToTitle

func SnakeToTitle(s any) string

Types

type ColorScheme

type ColorScheme struct {
	Success   lipgloss.Color
	Warning   lipgloss.Color
	Error     lipgloss.Color
	Highlight lipgloss.Color
	Muted     lipgloss.Color
}

ColorScheme describes a color scheme.

func DefaultColorScheme

func DefaultColorScheme() ColorScheme

DefaultColorScheme returns doctl's default color scheme.

type Style

type Style struct {
	// contains filtered or unexported fields
}

Style is a styled component.

func Margin

func Margin(i ...int) Style

func NewStyle

func NewStyle(style lipgloss.Style) Style

NewStyle creates a new styled component.

func (Style) Copy

func (s Style) Copy() Style

Copy returns a copy of the style.

func (Style) Inherit

func (s Style) Inherit(styles ...Style) Style

Inherit returns a copy of the original style with the properties from another style inherited. This follows lipgloss's inheritance behavior so margins, padding, and underlying string values are not inherited.

func (Style) InheritLipgloss

func (s Style) InheritLipgloss(styles ...lipgloss.Style) Style

Inherit returns a copy of the original style with the properties from a lipgloss.Style inherited. This follows lipgloss's inheritance behavior so margins, padding, and underlying string values are not inherited.

func (Style) Lipgloss

func (s Style) Lipgloss() lipgloss.Style

Lipgloss returns a copy of the underlying lipgloss.Style.

func (Style) Print

func (s Style) Print(str any) (int, error)

Print applies the style to the specified text and prints it to the output writer.

func (Style) Printf

func (s Style) Printf(format string, a ...any) (int, error)

Printf formats the specified text with the style applied and prints it to the output writer.

func (Style) S

func (s Style) S(str any) string

S is shorthand for Sprint.

func (Style) Sprint

func (s Style) Sprint(str any) string

Sprint applies the style to the specified text.

func (Style) Sprintf

func (s Style) Sprintf(format string, a ...any) string

Sprintf formats the specified text with the style applied.

func (Style) String

func (s Style) String() string

String implements the fmt.Stringer interface.

func (Style) WithOutput

func (s Style) WithOutput(output io.Writer) Style

WithOutput sets the output writer.

func (Style) WithString

func (s Style) WithString(str string) Style

WithString returns a copy of the style with the string configured for the String() method.

func (Style) Write

func (s Style) Write(b []byte) (n int, err error)

Write implements the io.Writer interface and prints to the output writer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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