common

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Color wraps termenv.ColorProfile.Color, which produces a termenv color
	// for use in termenv styling.
	Color func(string) te.Color = te.ColorProfile().Color

	// HasDarkBackground stores whether or not the terminal has a dark
	// background.
	HasDarkBackground = te.HasDarkBackground()
)
View Source
var (
	Indigo       = NewColorPair("#7571F9", "#5A56E0")
	SubtleIndigo = NewColorPair("#514DC1", "#7D79F6")
	Cream        = NewColorPair("#FFFDF5", "#FFFDF5")
	YellowGreen  = NewColorPair("#ECFD65", "#04B575")
	Yellow       = NewColorPair("#ECFD65", "#CCB12C")
	Fuschia      = NewColorPair("#EE6FF8", "#EE6FF8")
	Green        = NewColorPair("#04B575", "#04B575")
	Red          = NewColorPair("#ED567A", "#FF4672")
	FaintRed     = NewColorPair("#C74665", "#FF6F91")
	SpinnerColor = NewColorPair("#747373", "#8E8E8E")
	NoColor      = NewColorPair("", "")
)

Colors for dark and light backgrounds.

View Source
var Spinner = spinner.Dot

Functions

func HelpView

func HelpView(sections ...string) string

HelpView renders text intended to display at help text, often at the bottom of a view.

func KeyValueView

func KeyValueView(stuff ...string) string

KeyValueView renders key-value pairs.

func KeyValueViewWithoutVerticalLine

func KeyValueViewWithoutVerticalLine(stuff ...string) string

KeyValueViewWithoutVerticalLine renders key-value pairs without a vertical line.

func Subtle

func Subtle(s string) string

Subtle applies formatting to strings intended to be "subtle".

func VerticalLine

func VerticalLine(state State) string

VerticalLine return a vertical line colored according to the given state.

func Wrap

func Wrap(s string) string

Wrap wraps lines at a predefined width via package muesli/reflow.

Types

type ColorPair

type ColorPair struct {
	Dark  string
	Light string
}

func NewColorPair

func NewColorPair(dark, light string) ColorPair

NewColorPair is a helper function for creating a ColorPair.

func (ColorPair) Color

func (c ColorPair) Color() te.Color

Color returns the appropriate termenv.Color for the terminal background.

func (ColorPair) String

func (c ColorPair) String() string

type State

type State int

State is a general UI state used to help style components.

const (
	StateNormal State = iota
	StateSelected
	StateActive
	StateSpecial
	StateDeleting
)

UI states.

Jump to

Keyboard shortcuts

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