styles

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Spacer = lipgloss.NewStyle().Width

	StatusBarLogCount = lipgloss.NewStyle().
						Padding(0, 1).
						Foreground(DefaultColor.Light).
						Render

	StatusBarBeamInfo = lipgloss.NewStyle().
						Padding(0, 1)

	ErrorInfo = lipgloss.NewStyle().
				Padding(0, 1).
				Background(DefaultColor.Error).
				Render

	Bold = lipgloss.NewStyle().Bold(true).Copy()
)
View Source
var (
	BgFooter = lipgloss.AdaptiveColor{
		Light: "#2c323d",
		Dark:  "#2c323d",
	}
)
View Source
var DefaultColor = Color{
	Border:    lipgloss.Color("97"),
	Error:     lipgloss.Color("31"),
	Light:     lipgloss.Color("7"),
	Highlight: lipgloss.Color("11"),
}
View Source
var (
	SingleLineSpacer = lipgloss.NewStyle().Height(1).Width
)

Functions

func AvailableHeight added in v0.0.2

func AvailableHeight(height int) int

func FloatRight added in v0.1.0

func FloatRight(width int, str string) string

func InverseColor

func InverseColor(c lipgloss.Color) lipgloss.Color

func Overlay added in v0.1.0

func Overlay(
	x, y int,
	fg, bg string,
	shadow bool,
) string

BEGIN OF COPYWRITE The following code is copied from a PR created on lipgloss to solve the issue of overlaying elements. Please see the PR:

https://github.com/buztard/lipgloss/tree/feature/overlay

Could not find a Copywrite statement, however credits to @buztard (https://github.com/buztard) who implemented and created the PR. Once the PR or an alternative is released within the context of lipgloss this code will be replaced.

Thanks @buztard, you saved my day/ui with this one :-)!

func RandColor

func RandColor() (lipgloss.Color, lipgloss.Color)

func SpaceBetween added in v0.1.0

func SpaceBetween(width int, left []string, right []string, betweenChar string) string

SpaceBetween performs a row alignment on the left and right string slices where the content is pushed to the left and right respecifly as much as possible. Like in CSS display:flex; justify-content:space-between;. The slices should be of same length (each left[i] entry is matched with the right[i] entry). If the length differ, the short one is used as an upper limit.

Types

type Color

type Color struct {
	Border    lipgloss.Color `yaml:"border"`
	Error     lipgloss.Color `yaml:"error"`
	Highlight lipgloss.Color `yaml:"highlight"`
	Light     lipgloss.Color `yaml:"light"`
}

type Config added in v0.0.3

type Config struct {
	Colors Color `yaml:"colors"`
}

func LoadConfig added in v0.0.3

func LoadConfig() (*Config, error)

type Content added in v0.1.0

type Content struct {
	Dimensions
	// contains filtered or unexported fields
}

type Dimensions added in v0.1.0

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

func (Dimensions) Dims added in v0.1.0

func (dim Dimensions) Dims() Dimensions

func (Dimensions) Height added in v0.1.0

func (dim Dimensions) Height() int

func (Dimensions) Width added in v0.1.0

func (dim Dimensions) Width() int

type FooterLine added in v0.1.0

type FooterLine struct {
	Dimensions
	// contains filtered or unexported fields
}

func (*FooterLine) Render added in v0.1.0

func (footer *FooterLine) Render(content string) string

type Grid added in v0.1.0

type Grid struct {
	FullWidth  int
	FullHeight int

	// grid:
	// [tab] [tab] [tab]
	// .................
	// .....Content.....
	// .................
	// [footer] oX oX oX
	TabLine    TabLine
	Content    Content
	FooterLine FooterLine
}

func NewGrid added in v0.1.0

func NewGrid(width int, height int) Grid

func (*Grid) Adjust added in v0.1.0

func (grid *Grid) Adjust(width int, height int)

type TabLine added in v0.1.0

type TabLine struct {
	Dimensions
	// contains filtered or unexported fields
}

func (*TabLine) Render added in v0.1.0

func (tabs *TabLine) Render(content string) string

type Tabs added in v0.1.0

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

func NewTabs added in v0.1.0

func NewTabs(active int, lables ...string) *Tabs

func (*Tabs) SetActive added in v0.1.0

func (tabs *Tabs) SetActive(index int)

func (Tabs) View added in v0.1.0

func (tabs Tabs) View() string

Jump to

Keyboard shortcuts

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