Skip to content

theming

rovr can be themed in two ways, via the config.toml file and style.tcss file.

the config has a way to define themes using variables

[[custom_theme]]
name = "<name>"
primary = "<color>"
secondary = "<color>"
warning = "<color>"
error = "<color>"
success = "<color>"
accent = "<color>"
foreground = "<color>"
background = "<color>"
surface = "<color>"
panel = "<color>"
is_dark = true
variables = { "<var>" = "<key>" }

you can take a look at the reference in textual, or the table below

namedescription
namethe name of the theme
primarythe primary color, can be considered the branding color.
secondaryan alternative branding color.
warningthe default text color, which should be legible on background, surface, and panel.
errora color used for the background, where there is no content.
successthe default background color of widgets, typically sitting on top of background.
accenta color used to differentiate a part of the ui form the main content.
foregrounda color with alpha that can be used to create layers on a background.
backgroundindicates a warning. typically used as a background color.
surfaceindicates an error. typically used as a background color.
panelused to indicate success. typically used as a background color.
is_darkused sparingly to draw attention and contrasts with primary and secondary
variablescustom variables that are used by textual. variables

styling in textual is handled by tcss files, a simplified version of the web’s css. a reference is available in the textual docs

you can get the full DOM list by running

Terminal window
rovr --tree-dom

tcss works the same as css, so, if you want to target the FileList inside the #file_list_container you can do

#file_list_container > FileList {
...
}

however, if you took a look at the dom, or a truncated dom below

Application class="-dark-mode"
└── Vertical id="root"
└── HorizontalGroup id="main"
└── FileListContainer id="file_list_container"
└── FileList id="file_list" class="file-list"

you may notice that class inheritance is not shown, FileListContainer inherits VerticalGroup while FileList inherits SelectionList. I will soon add support, but not just yet.