ui

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package ui

Index

Constants

This section is empty.

Variables

View Source
var CatppuccinFrappe = Theme{
	Name:      "Frappé",
	ID:        "catppuccin-frappe",
	Rosewater: tcell.NewHexColor(0xf2d5cf),
	Flamingo:  tcell.NewHexColor(0xeebebe),
	Pink:      tcell.NewHexColor(0xf4b8e4),
	Mauve:     tcell.NewHexColor(0xca9ee6),
	Red:       tcell.NewHexColor(0xe78284),
	Maroon:    tcell.NewHexColor(0xea999c),
	Peach:     tcell.NewHexColor(0xef9f76),
	Yellow:    tcell.NewHexColor(0xe5c890),
	Green:     tcell.NewHexColor(0xa6d189),
	Teal:      tcell.NewHexColor(0x81c8be),
	Sky:       tcell.NewHexColor(0x99d1db),
	Sapphire:  tcell.NewHexColor(0x85c1dc),
	Blue:      tcell.NewHexColor(0x8caaee),
	Lavender:  tcell.NewHexColor(0xbabbf1),
	Text:      tcell.NewHexColor(0xc6d0f5),
	Subtext1:  tcell.NewHexColor(0xb5bfe2),
	Subtext0:  tcell.NewHexColor(0xa5adce),
	Overlay2:  tcell.NewHexColor(0x949cbb),
	Overlay1:  tcell.NewHexColor(0x838ba7),
	Overlay0:  tcell.NewHexColor(0x737994),
	Surface2:  tcell.NewHexColor(0x626880),
	Surface1:  tcell.NewHexColor(0x51576d),
	Surface0:  tcell.NewHexColor(0x414559),
	Base:      tcell.NewHexColor(0x303446),
	Mantle:    tcell.NewHexColor(0x292c3c),
	Crust:     tcell.NewHexColor(0x232634),
}
View Source
var CatppuccinLatte = Theme{
	Name:      "Latte",
	ID:        "catppuccin-latte",
	Rosewater: tcell.NewHexColor(0xdc8a78),
	Flamingo:  tcell.NewHexColor(0xdd7878),
	Pink:      tcell.NewHexColor(0xea76cb),
	Mauve:     tcell.NewHexColor(0x8839ef),
	Red:       tcell.NewHexColor(0xd20f39),
	Maroon:    tcell.NewHexColor(0xe64553),
	Peach:     tcell.NewHexColor(0xfe640b),
	Yellow:    tcell.NewHexColor(0xdf8e1d),
	Green:     tcell.NewHexColor(0x40a02b),
	Teal:      tcell.NewHexColor(0x179299),
	Sky:       tcell.NewHexColor(0x04a5e5),
	Sapphire:  tcell.NewHexColor(0x209fb5),
	Blue:      tcell.NewHexColor(0x1e66f5),
	Lavender:  tcell.NewHexColor(0x7287fd),
	Text:      tcell.NewHexColor(0x303030),
	Subtext1:  tcell.NewHexColor(0x404040),
	Subtext0:  tcell.NewHexColor(0x505050),
	Overlay2:  tcell.NewHexColor(0x606060),
	Overlay1:  tcell.NewHexColor(0x707070),
	Overlay0:  tcell.NewHexColor(0x808080),
	Surface2:  tcell.NewHexColor(0x909090),
	Surface1:  tcell.NewHexColor(0xa0a0a0),
	Surface0:  tcell.NewHexColor(0xb0b0b0),
	Base:      tcell.NewHexColor(0xeff1f5),
	Mantle:    tcell.NewHexColor(0xe6e9ef),
	Crust:     tcell.NewHexColor(0xdce0e8),
}
View Source
var CatppuccinMacchiato = Theme{
	Name:      "Macchiato",
	ID:        "catppuccin-macchiato",
	Rosewater: tcell.NewHexColor(0xf4dbd6),
	Flamingo:  tcell.NewHexColor(0xf0c6c6),
	Pink:      tcell.NewHexColor(0xf5bde6),
	Mauve:     tcell.NewHexColor(0xc6a0f6),
	Red:       tcell.NewHexColor(0xed8796),
	Maroon:    tcell.NewHexColor(0xee99a0),
	Peach:     tcell.NewHexColor(0xf5a97f),
	Yellow:    tcell.NewHexColor(0xeed49f),
	Green:     tcell.NewHexColor(0xa6da95),
	Teal:      tcell.NewHexColor(0x8bd5ca),
	Sky:       tcell.NewHexColor(0x91d7e3),
	Sapphire:  tcell.NewHexColor(0x7dc4e4),
	Blue:      tcell.NewHexColor(0x8aadf4),
	Lavender:  tcell.NewHexColor(0xb7bdf8),
	Text:      tcell.NewHexColor(0xcad3f5),
	Subtext1:  tcell.NewHexColor(0xb8c0e0),
	Subtext0:  tcell.NewHexColor(0xa5adcb),
	Overlay2:  tcell.NewHexColor(0x939ab7),
	Overlay1:  tcell.NewHexColor(0x8087a2),
	Overlay0:  tcell.NewHexColor(0x6e738d),
	Surface2:  tcell.NewHexColor(0x5b6078),
	Surface1:  tcell.NewHexColor(0x494d64),
	Surface0:  tcell.NewHexColor(0x363a4f),
	Base:      tcell.NewHexColor(0x24273a),
	Mantle:    tcell.NewHexColor(0x1e2030),
	Crust:     tcell.NewHexColor(0x181926),
}
View Source
var CatppuccinMocha = Theme{
	Name:      "Mocha",
	ID:        "catppuccin-mocha",
	Rosewater: tcell.NewHexColor(0xf5e0dc),
	Flamingo:  tcell.NewHexColor(0xf2cdcd),
	Pink:      tcell.NewHexColor(0xf5c2e7),
	Mauve:     tcell.NewHexColor(0xcba6f7),
	Red:       tcell.NewHexColor(0xf38ba8),
	Maroon:    tcell.NewHexColor(0xeba0ac),
	Peach:     tcell.NewHexColor(0xfab387),
	Yellow:    tcell.NewHexColor(0xf9e2af),
	Green:     tcell.NewHexColor(0xa6e3a1),
	Teal:      tcell.NewHexColor(0x94e2d5),
	Sky:       tcell.NewHexColor(0x89dceb),
	Sapphire:  tcell.NewHexColor(0x74c7ec),
	Blue:      tcell.NewHexColor(0x89b4fa),
	Lavender:  tcell.NewHexColor(0xb4befe),
	Text:      tcell.NewHexColor(0xcdd6f4),
	Subtext1:  tcell.NewHexColor(0xbac2de),
	Subtext0:  tcell.NewHexColor(0xa6adc8),
	Overlay2:  tcell.NewHexColor(0x9399b2),
	Overlay1:  tcell.NewHexColor(0x7f849c),
	Overlay0:  tcell.NewHexColor(0x6c7086),
	Surface2:  tcell.NewHexColor(0x585b70),
	Surface1:  tcell.NewHexColor(0x45475a),
	Surface0:  tcell.NewHexColor(0x313244),
	Base:      tcell.NewHexColor(0x1e1e2e),
	Mantle:    tcell.NewHexColor(0x181825),
	Crust:     tcell.NewHexColor(0x11111b),
}
View Source
var TerminalTheme = Theme{
	Name:      "Terminal",
	ID:        "terminal",
	Rosewater: tcell.ColorFuchsia,
	Flamingo:  tcell.ColorFuchsia,
	Pink:      tcell.ColorFuchsia,
	Mauve:     tcell.ColorPurple,
	Red:       tcell.ColorRed,
	Maroon:    tcell.ColorRed,
	Peach:     tcell.ColorYellow,
	Yellow:    tcell.ColorYellow,
	Green:     tcell.ColorGreen,
	Teal:      tcell.ColorTeal,
	Sky:       tcell.ColorAqua,
	Sapphire:  tcell.ColorAqua,
	Blue:      tcell.ColorBlue,
	Lavender:  tcell.ColorBlue,
	Text:      tcell.ColorDefault,
	Subtext1:  tcell.ColorSilver,
	Subtext0:  tcell.ColorGray,
	Overlay2:  tcell.ColorGray,
	Overlay1:  tcell.ColorGray,
	Overlay0:  tcell.ColorGray,
	Surface2:  tcell.ColorSilver,
	Surface1:  tcell.ColorGray,
	Surface0:  tcell.ColorGray,
	Base:      tcell.ColorDefault,
	Mantle:    tcell.ColorDefault,
	Crust:     tcell.ColorDefault,
}

TerminalTheme inherits the host terminal's colors. Backgrounds and primary text use tcell.ColorDefault (rendered as the terminal default), while accents use the ANSI 16-color palette so they follow the user's terminal theme.

Functions

func CheckYtDlpVersion

func CheckYtDlpVersion() (currentVersion, latestVersion string, needsUpdate bool)

func GetLanguageName

func GetLanguageName(lang Language) string

Types

type CustomList

type CustomList struct {
	*tview.Flex
	// contains filtered or unexported fields
}

func NewCustomList

func NewCustomList(theme *Theme) *CustomList

func (*CustomList) AddItem

func (c *CustomList) AddItem(track Track, index int)

func (*CustomList) Clear

func (c *CustomList) Clear()

func (*CustomList) GetCurrentItem

func (c *CustomList) GetCurrentItem() int

func (*CustomList) GetCurrentTrack

func (c *CustomList) GetCurrentTrack() *Track

func (*CustomList) IsFocused

func (c *CustomList) IsFocused(app *tview.Application) bool

func (*CustomList) MarkDirty

func (c *CustomList) MarkDirty()

func (*CustomList) RefreshIfResized

func (c *CustomList) RefreshIfResized()

func (*CustomList) SelectFirst

func (c *CustomList) SelectFirst()

func (*CustomList) SelectLast

func (c *CustomList) SelectLast()

func (*CustomList) SelectNext

func (c *CustomList) SelectNext()

func (*CustomList) SelectPrevious

func (c *CustomList) SelectPrevious()

func (*CustomList) SetBorderColor

func (c *CustomList) SetBorderColor(color tcell.Color) *CustomList

func (*CustomList) SetCurrentIndex

func (c *CustomList) SetCurrentIndex(idx int)

func (*CustomList) SetPlayingIndex

func (c *CustomList) SetPlayingIndex(idx int)

func (*CustomList) SetSelectedFunc

func (c *CustomList) SetSelectedFunc(handler func(int))

func (*CustomList) SetTheme

func (c *CustomList) SetTheme(theme *Theme)

func (*CustomList) SetThumbnail

func (c *CustomList) SetThumbnail(index int, img image.Image)

func (*CustomList) SetTitle

func (c *CustomList) SetTitle(title string) *CustomList

type CustomListItem

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

type HelpView

type HelpView struct {
	Flex *tview.Flex
	// contains filtered or unexported fields
}

func NewHelpView

func NewHelpView(s Strings, version string, theme *Theme, app *tview.Application, onClose func()) *HelpView

func (*HelpView) FocusContent

func (hv *HelpView) FocusContent()

type Language

type Language string
const (
	LanguagePT Language = "pt"
	LanguageEN Language = "en"
)

func GetAllLanguages

func GetAllLanguages() []Language

type Pagination

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

func NewPagination

func NewPagination(itemsPerPage int) *Pagination

func (*Pagination) GetCurrentPage

func (p *Pagination) GetCurrentPage() int

func (*Pagination) GetPageItems

func (p *Pagination) GetPageItems() (start, end int)

func (*Pagination) GetTotalPages

func (p *Pagination) GetTotalPages() int

func (*Pagination) NextPage

func (p *Pagination) NextPage() bool

func (*Pagination) PrevPage

func (p *Pagination) PrevPage() bool

func (*Pagination) Reset

func (p *Pagination) Reset()

func (*Pagination) SetCurrentPage

func (p *Pagination) SetCurrentPage(page int)

func (*Pagination) SetTotalItems

func (p *Pagination) SetTotalItems(total int)

type PlayMode

type PlayMode int
const (
	ModeAudio PlayMode = iota
	ModeVideo
)

func (PlayMode) String

func (m PlayMode) String() string

type PlaylistMode

type PlaylistMode int
const (
	ModeNormal PlaylistMode = iota
	ModeRepeatOne
	ModeRepeatAll
	ModeShuffle
)

func (PlaylistMode) String

func (m PlaylistMode) String() string

type SimpleApp

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

func NewSimpleApp

func NewSimpleApp(version string) *SimpleApp

func (*SimpleApp) AutoSaveState

func (a *SimpleApp) AutoSaveState()

func (*SimpleApp) RestoreState

func (a *SimpleApp) RestoreState() error

func (*SimpleApp) Run

func (a *SimpleApp) Run() error

func (*SimpleApp) SaveCurrentState

func (a *SimpleApp) SaveCurrentState() error

type Strings

type Strings struct {
	Search   string
	Results  string
	Playlist string
	Player   string
	Help     string
	Config   string

	Play     string
	Pause    string
	Stop     string
	Next     string
	Previous string
	Add      string
	Remove   string

	Audio     string
	Video     string
	Shuffle   string
	RepeatOne string
	RepeatAll string
	NoRepeat  string

	NoTrackPlaying         string
	Playing                string
	PlayingWithoutPlaylist string
	Paused                 string
	Stopped                string
	PlaylistFinished       string
	PlaybackFinished       string
	SkippingTo             string
	EnteringPlaylist       string
	AlreadyLastSong        string
	AlreadyFirstSong       string
	NothingPlaying         string

	AddedToPlaylist     string
	RemovedFromPlaylist string
	ItemMoved           string
	PlaylistEmpty       string

	Searching        string
	FoundResults     string
	SearchError      string
	NextPage         string
	PrevPage         string
	AlreadyLastPage  string
	AlreadyFirstPage string

	MpvError   string
	StateError string
	Error      string

	ModeChanged     string
	ThemeComingSoon string
	ThemeChanged    string
	LanguageChanged string

	Language     string
	Theme        string
	VideoQuality string
	VideoCodec   string
	DownloadDir  string
	Close        string

	QualityChanged string
	CodecChanged   string

	TypeToSearch  string
	NavigateLists string
	ShowHelp      string
	Quit          string

	HelpTitle      string
	HelpTabAll     string
	HelpNavigation string
	HelpSearch     string
	HelpResults    string
	HelpPlaylist   string
	HelpPlayer     string
	HelpGlobal     string
	HelpIcons      string

	NoTitle          string
	Unknown          string
	Channel          string
	Duration         string
	PressEnterToPlay string
	UnknownDate      string
	NoDescription    string
	Page             string

	CmdSearchBar   string
	CmdResultsBar  string
	CmdPlaylistBar string
	CmdPlayerBar   string
	CmdDefaultBar  string

	HelpNavigationText string
	HelpSearchText     string
	HelpResultsText    string
	HelpPlaylistText   string
	HelpPlayerText     string
	HelpGlobalText     string
	HelpIconsText      string

	ConfigText string
	EscToClose string

	URLCopied        string
	NoTrackSelected  string
	ClipboardError   string
	LoadingURL       string
	LoadingPlaylist  string
	PlaylistImported string

	EmptyQuery       string
	NoResultsFor     string
	YtDlpNotFound    string
	YtDlpStartFailed string
	YtDlpError       string

	TerminalVideo         string
	TerminalVideoStarting string

	Downloading      string
	DownloadComplete string
	DownloadError    string

	URLModalTitle string
	URLSaved      string
	// contains filtered or unexported fields
}

func GetStrings

func GetStrings(lang Language) Strings

type Theme

type Theme struct {
	Name      string
	ID        string
	Rosewater tcell.Color
	Flamingo  tcell.Color
	Pink      tcell.Color
	Mauve     tcell.Color
	Red       tcell.Color
	Maroon    tcell.Color
	Peach     tcell.Color
	Yellow    tcell.Color
	Green     tcell.Color
	Teal      tcell.Color
	Sky       tcell.Color
	Sapphire  tcell.Color
	Blue      tcell.Color
	Lavender  tcell.Color
	Text      tcell.Color
	Subtext1  tcell.Color
	Subtext0  tcell.Color
	Overlay2  tcell.Color
	Overlay1  tcell.Color
	Overlay0  tcell.Color
	Surface2  tcell.Color
	Surface1  tcell.Color
	Surface0  tcell.Color
	Base      tcell.Color
	Mantle    tcell.Color
	Crust     tcell.Color
}

func GetAllThemes

func GetAllThemes() []Theme

func GetThemeByID

func GetThemeByID(id string) *Theme

func LoadCustomTheme

func LoadCustomTheme(path string) (*Theme, error)

func (*Theme) GetAccent

func (t *Theme) GetAccent() tcell.Color

func (*Theme) GetBackground

func (t *Theme) GetBackground() tcell.Color

func (*Theme) GetError

func (t *Theme) GetError() tcell.Color

func (*Theme) GetFocusedBorder

func (t *Theme) GetFocusedBorder() tcell.Color

func (*Theme) GetHighlight

func (t *Theme) GetHighlight() tcell.Color

func (*Theme) GetPrimaryText

func (t *Theme) GetPrimaryText() tcell.Color

func (*Theme) GetSecondaryText

func (t *Theme) GetSecondaryText() tcell.Color

func (*Theme) GetSuccess

func (t *Theme) GetSuccess() tcell.Color

func (*Theme) GetUnfocusedBorder

func (t *Theme) GetUnfocusedBorder() tcell.Color

func (*Theme) GetWarning

func (t *Theme) GetWarning() tcell.Color

type ThemeTOML

type ThemeTOML struct {
	Name      string `toml:"name"`
	Rosewater string `toml:"rosewater"`
	Flamingo  string `toml:"flamingo"`
	Pink      string `toml:"pink"`
	Mauve     string `toml:"mauve"`
	Red       string `toml:"red"`
	Maroon    string `toml:"maroon"`
	Peach     string `toml:"peach"`
	Yellow    string `toml:"yellow"`
	Green     string `toml:"green"`
	Teal      string `toml:"teal"`
	Sky       string `toml:"sky"`
	Sapphire  string `toml:"sapphire"`
	Blue      string `toml:"blue"`
	Lavender  string `toml:"lavender"`
	Text      string `toml:"text"`
	Subtext1  string `toml:"subtext1"`
	Subtext0  string `toml:"subtext0"`
	Overlay2  string `toml:"overlay2"`
	Overlay1  string `toml:"overlay1"`
	Overlay0  string `toml:"overlay0"`
	Surface2  string `toml:"surface2"`
	Surface1  string `toml:"surface1"`
	Surface0  string `toml:"surface0"`
	Base      string `toml:"base"`
	Mantle    string `toml:"mantle"`
	Crust     string `toml:"crust"`
}

type ThumbnailCache

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

func NewThumbnailCache

func NewThumbnailCache() (*ThumbnailCache, error)

func (*ThumbnailCache) GetThumbnailImage

func (tc *ThumbnailCache) GetThumbnailImage(url string) (image.Image, error)

func (*ThumbnailCache) GetThumbnailImageWithContext

func (tc *ThumbnailCache) GetThumbnailImageWithContext(ctx context.Context, url string) (image.Image, error)

type Track

type Track struct {
	Title       string
	Author      string
	URL         string
	Thumbnail   string
	Duration    string
	PublishedAt string
	Description string
}

Directories

Path Synopsis
Package components
Package components

Jump to

Keyboard shortcuts

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