tui

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ConstHeight = 27
View Source
const ConstWidth = 35
View Source
const HexCodePattern = "[0-9a-fA-F]{6}"

HexCodePattern will regex match any 6 digit hexcode

Variables

View Source
var BlurredAreaStyle = textarea.Style{}
View Source
var DefaultTermBack lipgloss.Color
View Source
var DefaultTermFore lipgloss.Color
View Source
var EightBitMode = false
View Source
var FocusedAreaStyle = textarea.Style{}
View Source
var HelpDescStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{
	Light: "#B2B2B2",
	Dark:  "#4A4A4A",
})
View Source
var HelpKeyStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{
	Light: "#909090",
	Dark:  "#626262",
})
View Source
var SubtitleStyle = lipgloss.NewStyle().Italic(true).Foreground(lipgloss.Color("#888888"))
View Source
var ThemeConfigFolder = filepath.Join(UserConfig, "stylish")
View Source
var TitleStyle = lipgloss.NewStyle().Underline(true).Bold(true).Italic(true)
View Source
var UserConfig, _ = os.UserConfigDir()
View Source
var ViewportBorder = lipgloss.NewStyle().BorderStyle(lipgloss.RoundedBorder()).BorderForeground(lipgloss.Color("#4400FF")).Height(ConstHeight)

Functions

func Center

func Center(msg string) string

func CenterHorz

func CenterHorz(msg string) string

func GetItemDelgate

func GetItemDelgate() (del list.DefaultDelegate)

func GetTermSize

func GetTermSize() (int, int)

func HexToEightBit

func HexToEightBit(hex string) termenv.Color

func HexToRGB

func HexToRGB(hex string) termenv.RGBColor

func ProgramHeader

func ProgramHeader() string

func RenderModel

func RenderModel(body, footer string) string

func ValidHexCode

func ValidHexCode(input string) error

Types

type LandingModel

type LandingModel struct {
	ThemeList   list.Model
	ThemeInput  textinput.Model
	InputActive bool

	DeleteActive bool
	// contains filtered or unexported fields
}

func NewLandingModel

func NewLandingModel() LandingModel

func (LandingModel) Init

func (m LandingModel) Init() tea.Cmd

func (LandingModel) Update

func (m LandingModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (LandingModel) View

func (m LandingModel) View() string

type Style

type Style struct {
	Theme string `yaml:"theme"`
	Name  string `yaml:"name"`

	Bold  bool `yaml:"bold"`
	Under bool `yaml:"under"`
	Blink bool `yaml:"blink"`

	Fore string `yaml:"fore"`
	Back string `yaml:"back"`

	FileTypes []string `yaml:"filetypes"`
}

func CopyStyle

func CopyStyle(style Style, newName string) Style

func GetStyle

func GetStyle(theme, styleName string) Style

func NewStyle

func NewStyle(themeName, styleName string) Style

func (Style) Description

func (s Style) Description() string

3 Row description

func (Style) FilterValue

func (s Style) FilterValue() string

func (Style) GetDirColorBlock

func (s Style) GetDirColorBlock() string

func (Style) SaveStyle

func (s Style) SaveStyle()

func (*Style) SetBack

func (s *Style) SetBack(back string)

func (*Style) SetFiles

func (s *Style) SetFiles(files string)

func (*Style) SetFore

func (s *Style) SetFore(fore string)

func (Style) Title

func (s Style) Title() string

These functions fullfil the tea.DefaultItemValue interface

func (s *Style) ToggleBlink()

func (*Style) ToggleBold

func (s *Style) ToggleBold()

func (*Style) ToggleUnder

func (s *Style) ToggleUnder()

type Theme

type Theme struct {
	Name   string
	Path   string
	Styles []Style
}

Theme represents a collection of Styles

func GetAllThemes

func GetAllThemes() []Theme

GetAllThemes will return a slice containing all Themes

func GetTheme

func GetTheme(name string) Theme

GetTheme will get the theme of a given name. If the provided name doesn't exist, a folder for that theme will be created.

func (Theme) Description

func (t Theme) Description() string

func (Theme) DoesStyleExist

func (t Theme) DoesStyleExist(styleName string) bool

func (Theme) FilterValue

func (t Theme) FilterValue() string

These functions fullfil the tea.DefaultItemValue interface

func (Theme) GenerateDirColors

func (t Theme) GenerateDirColors() error

GenerateDirColors will convert all of a theme's styles into an output file

func (Theme) LoadStyles

func (t Theme) LoadStyles() []Style

LoadStyles will load all of the styles for a given theme

func (*Theme) RemoveStyle

func (t *Theme) RemoveStyle(styleName string)

RemoveStyle will remove the style with a given name from both the theme's list and from the file system

func (Theme) Title

func (t Theme) Title() string

type ThemeModel

type ThemeModel struct {
	Theme     Theme
	StyleList list.Model

	NameInput  textinput.Model
	ColorInput textinput.Model
	FilesInput textarea.Model
	// contains filtered or unexported fields
}

func NewThemeModel

func NewThemeModel(theme Theme) ThemeModel

func (ThemeModel) Init

func (m ThemeModel) Init() tea.Cmd

func (ThemeModel) Update

func (m ThemeModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ThemeModel) View

func (m ThemeModel) View() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳