Documentation ¶
Index ¶
- Variables
- func FormatRegion(region string, context ThemeContext, item ThemeItem) string
- func GetLabel(property ThemeProperty, label string, spaced bool) string
- func GetThemeRegion(name string) (string, string, bool)
- func GetThemeSetting(p ThemeProperty) (tcell.Style, string, bool)
- func GetThemedLabel(property ThemeProperty, label string, spaced bool) string
- func GetThemedRegions(text string) string
- func NewBox(property ThemeProperty) *tview.Box
- func NewDropDown(property ThemeProperty, label string) *tview.DropDown
- func NewFlex(property ThemeProperty) *tview.Flex
- func NewForm(property ThemeProperty) *tview.Form
- func NewImage(property ThemeProperty) *tview.Image
- func NewInputField(property ThemeProperty, label string) *tview.InputField
- func NewPages(property ThemeProperty) *tview.Pages
- func NewTable(property ThemeProperty) *tview.Table
- func NewTableCell(context ThemeContext, item ThemeItem, text string) *tview.TableCell
- func NewTextView(property ThemeProperty) *tview.TextView
- func NewTreeView(property ThemeProperty) *tview.TreeView
- func ParseFile(themePath string) error
- func SetDrawFunc(draw func(p tview.Primitive))
- func SetTextStyle(region, text string, context ThemeContext, item ThemeItem) string
- func SetThemeProperty(primitive tview.Primitive, property *ThemeProperty, labelWidth ...int)
- func UpdateThemeVersion()
- func WrapDrawFunc(primitive tview.Primitive, property ThemeProperty, ...)
- type ThemeConfig
- type ThemeContext
- type ThemeItem
- type ThemePrimitive
- type ThemePrimitiveConfig
- type ThemeProperty
- type ThemeSetting
- type ThemeTextBuilder
- func (t *ThemeTextBuilder) Append(item ThemeItem, region, text string)
- func (t *ThemeTextBuilder) AppendText(text string)
- func (t *ThemeTextBuilder) Finish()
- func (t *ThemeTextBuilder) Format(item ThemeItem, region, format string, values ...any)
- func (t *ThemeTextBuilder) Get(noclear ...struct{}) string
- func (t *ThemeTextBuilder) Len() int
- func (t *ThemeTextBuilder) Start(item ThemeItem, region string)
- func (t *ThemeTextBuilder) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
var DefaultThemeConfig = `` /* 10098-byte string literal not displayed */
DefaultThemeConfig is the default theme configuration in the HJSON format.
var ThemeScopes = map[ThemeContext]map[ThemeItem]struct{}{ ThemeContextApp: { ThemeAuthor: struct{}{}, ThemeBackground: struct{}{}, ThemeBorder: struct{}{}, ThemeChannel: struct{}{}, ThemeDescription: struct{}{}, ThemeDuration: struct{}{}, ThemeErrorMessage: struct{}{}, ThemeFormButton: struct{}{}, ThemeFormField: struct{}{}, ThemeFormLabel: struct{}{}, ThemeFormOptions: struct{}{}, ThemeInfoMessage: struct{}{}, ThemeInputField: struct{}{}, ThemeInputLabel: struct{}{}, ThemeInstanceURI: struct{}{}, ThemeLikes: struct{}{}, ThemeListField: struct{}{}, ThemeListLabel: struct{}{}, ThemeListOptions: struct{}{}, ThemeMediaType: struct{}{}, ThemePlaylist: struct{}{}, ThemePopupBackground: struct{}{}, ThemePopupBorder: struct{}{}, ThemeProgressBar: struct{}{}, ThemeProgressText: struct{}{}, ThemePublished: struct{}{}, ThemeSelector: struct{}{}, ThemeSubscribers: struct{}{}, ThemeTabs: struct{}{}, ThemeTagStatusBar: struct{}{}, ThemeText: struct{}{}, ThemeTitle: struct{}{}, ThemeTotalDuration: struct{}{}, ThemeTotalVideos: struct{}{}, ThemeVideo: struct{}{}, ThemeViews: struct{}{}, }, ThemeContextChannel: { ThemeBackground: struct{}{}, ThemeBorder: struct{}{}, ThemeDescription: struct{}{}, ThemeMediaType: struct{}{}, ThemePlaylist: struct{}{}, ThemeSelector: struct{}{}, ThemeTabs: struct{}{}, ThemeTitle: struct{}{}, ThemeTotalDuration: struct{}{}, ThemeTotalVideos: struct{}{}, ThemeVideo: struct{}{}, }, ThemeContextComments: { ThemeAuthor: struct{}{}, ThemeAuthorOwner: struct{}{}, ThemeAuthorVerified: struct{}{}, ThemeComment: struct{}{}, ThemeLikes: struct{}{}, ThemePublished: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeSelector: struct{}{}, ThemeText: struct{}{}, ThemeTitle: struct{}{}, ThemeVideo: struct{}{}, }, ThemeContextDashboard: { ThemeBorder: struct{}{}, ThemeBackground: struct{}{}, ThemeChannel: struct{}{}, ThemeFormButton: struct{}{}, ThemeFormField: struct{}{}, ThemeFormLabel: struct{}{}, ThemeFormOptions: struct{}{}, ThemeInputField: struct{}{}, ThemeInputLabel: struct{}{}, ThemeInstanceURI: struct{}{}, ThemeListField: struct{}{}, ThemeListLabel: struct{}{}, ThemeListOptions: struct{}{}, ThemePlaylist: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeSelector: struct{}{}, ThemeTabs: struct{}{}, ThemeText: struct{}{}, ThemeTotalDuration: struct{}{}, ThemeTotalVideos: struct{}{}, ThemeVideo: struct{}{}, }, ThemeContextDownloads: { ThemeAudioChannels: struct{}{}, ThemeAudioSampleRate: struct{}{}, ThemeBackground: struct{}{}, ThemeMediaInfo: struct{}{}, ThemeMediaSize: struct{}{}, ThemeMediaType: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeProgressBar: struct{}{}, ThemeProgressText: struct{}{}, ThemeSelector: struct{}{}, ThemeTitle: struct{}{}, ThemeVideoFPS: struct{}{}, ThemeVideoResolution: struct{}{}, }, ThemeContextFetcher: { ThemeAuthor: struct{}{}, ThemeErrorMessage: struct{}{}, ThemeInfoMessage: struct{}{}, ThemeMediaType: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeProgressText: struct{}{}, ThemeSelector: struct{}{}, ThemeTagAdding: struct{}{}, ThemeTagError: struct{}{}, ThemeTagStatusBar: struct{}{}, ThemeTitle: struct{}{}, ThemeVideo: struct{}{}, }, ThemeContextFiles: { ThemeDirectory: struct{}{}, ThemeFile: struct{}{}, ThemeInputField: struct{}{}, ThemeInputLabel: struct{}{}, ThemePath: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeSelector: struct{}{}, ThemeTitle: struct{}{}, }, ThemeContextHistory: { ThemeInputField: struct{}{}, ThemeInputLabel: struct{}{}, ThemeMediaType: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeSelector: struct{}{}, ThemeTitle: struct{}{}, ThemeVideo: struct{}{}, }, ThemeContextInstances: { ThemeBackground: struct{}{}, ThemeInstanceURI: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeSelector: struct{}{}, ThemeTagChanged: struct{}{}, ThemeTitle: struct{}{}, }, ThemeContextLinks: { ThemeInvidiousURI: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeSelector: struct{}{}, ThemeText: struct{}{}, ThemeTitle: struct{}{}, ThemeYoutubeURI: struct{}{}, }, ThemeContextCustomSeeker: { ThemeFormField: struct{}{}, ThemeFormLabel: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeText: struct{}{}, ThemeTitle: struct{}{}, }, ThemeContextMenu: { ThemeBackground: struct{}{}, ThemeBorder: struct{}{}, ThemeDescription: struct{}{}, ThemeKeybinding: struct{}{}, ThemeName: struct{}{}, ThemePopupBorder: struct{}{}, ThemePopupBackground: struct{}{}, ThemeSelector: struct{}{}, }, ThemeContextPlayer: { ThemeBackground: struct{}{}, ThemeBuffer: struct{}{}, ThemeDuration: struct{}{}, ThemeLoop: struct{}{}, ThemeMediaType: struct{}{}, ThemePause: struct{}{}, ThemePlay: struct{}{}, ThemeProgressBar: struct{}{}, ThemeSelector: struct{}{}, ThemeShuffle: struct{}{}, ThemeTitle: struct{}{}, ThemeTotalDuration: struct{}{}, ThemeVolume: struct{}{}, }, ThemeContextPlayerInfo: { ThemeAuthor: struct{}{}, ThemeBackground: struct{}{}, ThemeBorder: struct{}{}, ThemeDescription: struct{}{}, ThemeLikes: struct{}{}, ThemeListField: struct{}{}, ThemeListLabel: struct{}{}, ThemeListOptions: struct{}{}, ThemePublished: struct{}{}, ThemeSubscribers: struct{}{}, ThemeTitle: struct{}{}, ThemeViews: struct{}{}, }, ThemeContextPlaylist: { ThemeAuthor: struct{}{}, ThemeBackground: struct{}{}, ThemeBorder: struct{}{}, ThemeSelector: struct{}{}, ThemeTabs: struct{}{}, ThemeTotalDuration: struct{}{}, ThemeTotalVideos: struct{}{}, ThemeVideo: struct{}{}, }, ThemeContextQueue: { ThemeAuthor: struct{}{}, ThemeMediaType: struct{}{}, ThemeMoveModeSelector: struct{}{}, ThemeNormalModeSelector: struct{}{}, ThemePopupBackground: struct{}{}, ThemePopupBorder: struct{}{}, ThemeSelector: struct{}{}, ThemeTagFetching: struct{}{}, ThemeTagLoading: struct{}{}, ThemeTagPlaying: struct{}{}, ThemeTagStopped: struct{}{}, ThemeTabs: struct{}{}, ThemeTitle: struct{}{}, ThemeTotalDuration: struct{}{}, ThemeVideo: struct{}{}, }, ThemeContextSearch: { ThemeAuthor: struct{}{}, ThemeBackground: struct{}{}, ThemeBorder: struct{}{}, ThemeChannel: struct{}{}, ThemeFormButton: struct{}{}, ThemeFormField: struct{}{}, ThemeFormLabel: struct{}{}, ThemeFormOptions: struct{}{}, ThemeInputField: struct{}{}, ThemeInputLabel: struct{}{}, ThemePopupBackground: struct{}{}, ThemePopupBorder: struct{}{}, ThemePlaylist: struct{}{}, ThemeSelector: struct{}{}, ThemeTabs: struct{}{}, ThemeTitle: struct{}{}, ThemeText: struct{}{}, ThemeTotalDuration: struct{}{}, ThemeTotalVideos: struct{}{}, ThemeVideo: struct{}{}, }, ThemeContextStart: { ThemeText: struct{}{}, ThemeBackground: struct{}{}, }, ThemeContextStatusBar: { ThemeBackground: struct{}{}, ThemeErrorMessage: struct{}{}, ThemeInfoMessage: struct{}{}, ThemeInputField: struct{}{}, ThemeInputLabel: struct{}{}, ThemeTagStatusBar: struct{}{}, }, }
ThemeScopes store the ThemeItem scopes for each ThemeContext.
Functions ¶
func FormatRegion ¶
func FormatRegion(region string, context ThemeContext, item ThemeItem) string
FormatRegion formats and returns the ThemeContext, ThemeItem and region name into a region tag.
func GetLabel ¶
func GetLabel(property ThemeProperty, label string, spaced bool) string
GetLabel returns a theme formatted label for primitives.
func GetThemeRegion ¶
GetThemeRegion returns the region name from a region tag.
func GetThemeSetting ¶
func GetThemeSetting(p ThemeProperty) (tcell.Style, string, bool)
GetThemeSetting returns a style and tag according to the ThemeProperty.
func GetThemedLabel ¶
func GetThemedLabel(property ThemeProperty, label string, spaced bool) string
GetThemedLabel checks whether the label is formatted and reformats it, or returns a newly formatted label.
func GetThemedRegions ¶
GetThemedRegions appends style tags for each region and returns the text.
func NewDropDown ¶
func NewDropDown(property ThemeProperty, label string) *tview.DropDown
NewDropDown returns a new dropdown primitive.
func NewFlex ¶
func NewFlex(property ThemeProperty) *tview.Flex
NewFlex returns a new flex primitive.
func NewForm ¶
func NewForm(property ThemeProperty) *tview.Form
NewForm returns a new form primitive.
func NewImage ¶
func NewImage(property ThemeProperty) *tview.Image
NewImage returns a new image primitive.
func NewInputField ¶
func NewInputField(property ThemeProperty, label string) *tview.InputField
NewInputField returns a new inputfield primitive.
func NewPages ¶
func NewPages(property ThemeProperty) *tview.Pages
NewPages returns a new pages primitive.
func NewTable ¶
func NewTable(property ThemeProperty) *tview.Table
NewTable returns a new table primitive.
func NewTableCell ¶
func NewTableCell(context ThemeContext, item ThemeItem, text string) *tview.TableCell
NewTableCell returns a new tablecell.
func NewTextView ¶
func NewTextView(property ThemeProperty) *tview.TextView
NewTextView returns a new textview primitive.
func NewTreeView ¶
func NewTreeView(property ThemeProperty) *tview.TreeView
NewTreeView returns a new treeview primitive.
func SetDrawFunc ¶
SetDrawFunc sets the primitive's draw handler.
func SetTextStyle ¶
func SetTextStyle(region, text string, context ThemeContext, item ThemeItem) string
SetTextStyle sets style tags for the provided text.
func SetThemeProperty ¶
func SetThemeProperty(primitive tview.Primitive, property *ThemeProperty, labelWidth ...int)
SetThemeProperty updates the ThemeProperty's version and applies the theme for its primitive.
func WrapDrawFunc ¶
func WrapDrawFunc( primitive tview.Primitive, property ThemeProperty, drawFunc func(s tcell.Screen, x, y, width, height int) (int, int, int, int), noapply ...struct{}, )
WrapDrawFunc wraps the primitive's DrawFunc with SetThemeProperty.
Types ¶
type ThemeConfig ¶
ThemeConfig describes the theme configuration settings.
func GetConfigHandler ¶
func GetConfigHandler() *ThemeConfig
GetConfigHandler returns the theme configuration handler.
func (*ThemeConfig) Generate ¶
func (c *ThemeConfig) Generate(k *koanf.Koanf) (interface{}, error)
Generate generates the theme configuration.
func (*ThemeConfig) Parse ¶
func (c *ThemeConfig) Parse(k *koanf.Koanf, dir string) error
Parse parses the theme from the configuration.
type ThemeContext ¶
type ThemeContext string
ThemeContext describes the type of context to apply the color into.
const ( ThemeContextApp ThemeContext = "App" ThemeContextMenu ThemeContext = "Menu" ThemeContextStatusBar ThemeContext = "StatusBar" ThemeContextInstances ThemeContext = "Instances" ThemeContextLinks ThemeContext = "Links" ThemeContextPlayerInfo ThemeContext = "PlayerInfo" ThemeContextPlayer ThemeContext = "Player" ThemeContextSearch ThemeContext = "Search" ThemeContextDashboard ThemeContext = "Dashboard" ThemeContextFiles ThemeContext = "Files" ThemeContextDownloads ThemeContext = "Downloads" ThemeContextQueue ThemeContext = "Queue" ThemeContextFetcher ThemeContext = "Fetcher" ThemeContextComments ThemeContext = "Comments" ThemeContextStart ThemeContext = "Start" ThemeContextPlaylist ThemeContext = "Playlist" ThemeContextChannel ThemeContext = "Channel" ThemeContextHistory ThemeContext = "History" ThemeContextCustomSeeker ThemeContext = "CustomSeeker" )
The different context types for themes.
type ThemeItem ¶
type ThemeItem string
ThemeItem describes a theme item.
const ( ThemeText ThemeItem = "Text" ThemeBorder ThemeItem = "Border" ThemeTitle ThemeItem = "Title" ThemeTabs ThemeItem = "Tabs" ThemeBackground ThemeItem = "Background" ThemePopupBackground ThemeItem = "PopupBackground" ThemePopupBorder ThemeItem = "PopupBorder" ThemeInputLabel ThemeItem = "InputLabel" ThemeInputField ThemeItem = "InputField" ThemeListLabel ThemeItem = "ListLabel" ThemeListField ThemeItem = "ListField" ThemeListOptions ThemeItem = "ListOptions" ThemeFormButton ThemeItem = "FormButton" ThemeFormLabel ThemeItem = "FormLabel" ThemeFormField ThemeItem = "FormField" ThemeFormOptions ThemeItem = "FormOptions" ThemeSelector ThemeItem = "Selector" ThemeNormalModeSelector ThemeItem = "NormalModeSelector" ThemeMoveModeSelector ThemeItem = "MoveModeSelector" ThemeInfoMessage ThemeItem = "InfoMessage" ThemeErrorMessage ThemeItem = "ErrorMessage" ThemeProgressBar ThemeItem = "ProgressBar" ThemeProgressText ThemeItem = "ProgressText" ThemeTagStatusBar ThemeItem = "TagStatusBar" ThemeTagFetching ThemeItem = "TagFetching" ThemeTagLoading ThemeItem = "TagLoading" ThemeTagAdding ThemeItem = "TagAdding" ThemeTagStopped ThemeItem = "TagStopped" ThemeTagError ThemeItem = "TagError" ThemeTagPlaying ThemeItem = "TagPlaying" ThemeTagChanged ThemeItem = "TagChanged" ThemeName ThemeItem = "Name" ThemeDescription ThemeItem = "Description" ThemeKeybinding ThemeItem = "Keybinding" ThemeDirectory ThemeItem = "Directory" ThemeFile ThemeItem = "File" ThemePath ThemeItem = "Path" ThemeVideo ThemeItem = "Video" ThemePlaylist ThemeItem = "Playlist" ThemeAuthor ThemeItem = "Author" ThemeAuthorOwner ThemeItem = "AuthorOwner" ThemeAuthorVerified ThemeItem = "AuthorVerified" ThemeTotalVideos ThemeItem = "TotalVideos" ThemeShuffle ThemeItem = "Shuffle" ThemeLoop ThemeItem = "Loop" ThemeVolume ThemeItem = "Volume" ThemeDuration ThemeItem = "Duration" ThemeTotalDuration ThemeItem = "TotalDuration" ThemePause ThemeItem = "Pause" ThemePlay ThemeItem = "Play" ThemeBuffer ThemeItem = "Buffer" ThemeMute ThemeItem = "Mute" ThemeStop ThemeItem = "Stop" ThemeChannel ThemeItem = "Channel" ThemeComment ThemeItem = "Comment" ThemeViews ThemeItem = "Views" ThemeLikes ThemeItem = "Likes" ThemeSubscribers ThemeItem = "Subscribers" ThemePublished ThemeItem = "Published" ThemeInstanceURI ThemeItem = "InstanceURI" ThemeInvidiousURI ThemeItem = "InvidiousURI" ThemeYoutubeURI ThemeItem = "YoutubeURI" ThemeMediaInfo ThemeItem = "MediaInfo" ThemeMediaSize ThemeItem = "MediaSize" ThemeMediaType ThemeItem = "MediaType" ThemeVideoResolution ThemeItem = "VideoResolution" ThemeVideoFPS ThemeItem = "VideoFPS" ThemeAudioSampleRate ThemeItem = "AudioSampleRate" ThemeAudioChannels ThemeItem = "AudioChannels" )
The different item types for themes.
type ThemePrimitive ¶
type ThemePrimitive interface { SetDrawFunc(func(s tcell.Screen, x, y, width, height int) (int, int, int, int)) *tview.Box SetBorderStyle(tcell.Style) *tview.Box SetBackgroundColor(tcell.Color) *tview.Box GetTitle() string SetTitle(title string) *tview.Box }
ThemePrimitive describes a theme primitive.
type ThemePrimitiveConfig ¶
type ThemePrimitiveConfig struct { // Version is the global theme updater version. // All ThemeProperties check this version before updating its attached primitive. Version int // Draw draws the primitive onto the screen. Draw func(p tview.Primitive) }
ThemePrimitiveConfig stores the configuration for all primitives.
type ThemeProperty ¶
type ThemeProperty struct { Version int Context ThemeContext Item ThemeItem IsForm bool }
ThemeProperty describes a theme property.
func (ThemeProperty) SetContext ¶
func (t ThemeProperty) SetContext(context ThemeContext) ThemeProperty
SetContext sets the ThemeContext for the ThemeProperty.
func (ThemeProperty) SetItem ¶
func (t ThemeProperty) SetItem(item ThemeItem) ThemeProperty
SetItem sets the ThemeItem for the ThemeProperty.
type ThemeSetting ¶
type ThemeSetting struct { Style tcell.Style Tag string }
ThemeSetting describes a theme setting.
type ThemeTextBuilder ¶
type ThemeTextBuilder struct {
// contains filtered or unexported fields
}
ThemeTextBuilder describes a text builder for themed text.
func NewTextBuilder ¶
func NewTextBuilder(context ThemeContext) ThemeTextBuilder
NewTextBuilder returns a new theme text builder.
func (*ThemeTextBuilder) Append ¶
func (t *ThemeTextBuilder) Append(item ThemeItem, region, text string)
Append applies the start tags, appends the text to the text builder and applies the end tags.
func (*ThemeTextBuilder) AppendText ¶
func (t *ThemeTextBuilder) AppendText(text string)
AppendText appends text to the text builder.
func (*ThemeTextBuilder) Finish ¶
func (t *ThemeTextBuilder) Finish()
Finish applies the end tags to the text builder.
func (*ThemeTextBuilder) Format ¶
func (t *ThemeTextBuilder) Format(item ThemeItem, region, format string, values ...any)
Format applies the start tags, appends formatted text to the text builder and applies the end tags.
func (*ThemeTextBuilder) Get ¶
func (t *ThemeTextBuilder) Get(noclear ...struct{}) string
Get returns the text from the text builder.
func (*ThemeTextBuilder) Len ¶
func (t *ThemeTextBuilder) Len() int
Len returns the size of the text builder.
func (*ThemeTextBuilder) Start ¶
func (t *ThemeTextBuilder) Start(item ThemeItem, region string)
Start appends the region and starting style tag to the text builder.