-
-
Notifications
You must be signed in to change notification settings - Fork 123
Theming
A style specifies the appearance of a widget. More complex widgets allow you to set multiple styles for different aspects, e.g., Button
may have one style for its normal state and another for when it's focused.
A selector is a string of dot(.
)-separated sections, to which you can attach a Style
.
- The first section should be the name of the widget.
- If a section specifies a state, it should be in the form of "This widget is
state
", e.g.,focused
,selected
.
Example: list.item.selected
lets you specify the style for a selected item within a list.
An application may specify a theme, which is a complete specification of the styles used throughout the application.
theme := tui.NewTheme()
theme.SetStyle("list.item.selected", tui.Style{Fg: tui.ColorWhite, Bg: tui.ColorBlue})
ui.SetTheme(theme)
By default, applications should be monochrome. This is usually accomplished by simply not adding it to the DefaultTheme
. However, widgets that can be selected or focused needs to be defined with Reverse: true
.
When using window managers like i3 or dwm I want my applications to follow the same color scheme. By introducing a configuration file that is shared across application written using tui they will get a consistent look.