lipglosstext

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

lipgloss-text

Lipgloss helper libraly for making styled text with ease

Made with VHS

how to use

text/line

the two main types you should be using are Line and Text.

there is also Spantype but its not nececary most conviniet one to use to to use Line from can take string int float32/64 bool span and slices of ever of this types Text takes all types that Line takes and in additon it can take Line []Line Non supported Types will return type (Your Invalid Type) not suported!

Line

line := LineFrom("line from string", myStyle)
fmt.Println(line.Render())

Text

text := TextFrom(line, myStyle)
fmt.Println(text.Render())

options

There are two options as for now (you can make an issue if you wan't me to add more) that can be used in Render() method. if non are passed defaults will be aplied. If non values a

  • Styled bool value telling if style will be aplied def true
  • Delimiter delimiter bettwen strings for Line def " " for Text def "\n"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delimiter

type Delimiter string

func (Delimiter) Opt

func (t Delimiter) Opt() interface{}

type Line

type Line []Span

func LineFrom

func LineFrom(t interface{}, style ...lipgloss.Style) Line

/ takes ([]Span, Span, string) and optional style returns Line

func (*Line) Append

func (l *Line) Append(rhs ...interface{}) error

func (Line) Render

func (l Line) Render(options ...Option) string

type Option

type Option interface {
	Opt() interface{}
}

type Span

type Span struct {
	lipgloss.Style
	// contains filtered or unexported fields
}

func SpanFrom

func SpanFrom(text string, style lipgloss.Style) Span

/ takes string and style returns Span

func (Span) Render

func (s Span) Render(styled bool) string

type Styled

type Styled bool

func (Styled) Opt

func (t Styled) Opt() interface{}

type Text

type Text []Line

func TextFrom

func TextFrom(t interface{}, style ...lipgloss.Style) Text

/ takes ([]Span, Span, string, Line, []Line) and optional style returns Text

func (*Text) Append

func (t *Text) Append(rhs ...interface{}) error

func (Text) Render

func (t Text) Render(options ...Option) string

Jump to

Keyboard shortcuts

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