Skip to content

Latest commit

 

History

History
122 lines (91 loc) · 5.09 KB

THEMES.md

File metadata and controls

122 lines (91 loc) · 5.09 KB

Themes

default on light terminal:

Configuration

To change the colors of the default theme you need to add a theme.ron file that contains the colors you want to override. Note that you don’t have to specify the full theme anymore (as of 0.23). Instead, it is sufficient to override just the values that you want to differ from their default values.

The file uses the Ron format and is located at one of the following paths, depending on your operating system:

  • $HOME/.config/gitui/theme.ron (mac)
  • $XDG_CONFIG_HOME/gitui/theme.ron (linux using XDG)
  • $HOME/.config/gitui/theme.ron (linux)
  • %APPDATA%/gitui/theme.ron (Windows)

Alternatively, you can create a theme in the same directory mentioned above and use it with the -t flag followed by the name of the file in the directory. E.g. If you are on linux calling gitui -t arc.ron, this will load the theme in $XDG_CONFIG_HOME/gitui/arc.ron or $HOME/.config/gitui/arc.ron.

Example theme override:

(
    selection_bg: Some("Blue"),
    selection_fg: Some("#ffffff"),
    use_selection_fg: Some(true),
    use_selection_bg: Some(true),
    selection_bold: Some(true),
    selection_italic: Some(true),
)

Note that you need to wrap values in Some due to the way the overrides work (as of 0.23).

Notes:

  • rgb colors might not be supported in every terminal.
  • using a color like yellow might appear in whatever your terminal/theme defines for yellow
  • valid colors can be found in ratatui's Color struct.
  • all customizable theme elements can be found in style.rs in the impl Default for Theme block

Preset Themes

You can find preset themes by Catppuccin here.

Syntax Highlighting

The syntax highlighting theme can be defined using the element syntax. Both default themes of the syntect library and custom themes are supported.

Example syntax theme:

(
    syntax: Some("InspiredGitHub"),
)

Custom themes are located in the configuration directory, are using TextMate's theme format and must have a .tmTheme file extension. To load a custom theme, syntax must be set to the file name without the file extension. For example, to load Blackboard.tmTheme, place the file next to theme.ron and set:

(
    syntax: Some("Blackboard"),
)

filmgirl/TextMate-Themes offers many beautiful TextMate themes to choose from.

Customizing line breaks

If you want to change how the line break is displayed in the diff, you can also specify line_break in your theme.ron:

(
    line_break: Some("¶"),
)

Note that if you want to turn it off, you should use a blank string:

(
    line_break: Some(""),
)

Customizing selection

By default selection is indicated using bold and italic text modifiers without changing foreground or background colors. You can opt back into the previous background highlight or override colors via the following booleans:

(
    use_selection_bg: Some(true),
    use_selection_fg: Some(true),
    selection_bold: Some(false),
    selection_italic: Some(false),
)
  • use_selection_bg (default false) controls whether selected rows are rendered with selection_bg.
  • use_selection_fg (default false) controls whether selected rows use selection_fg.
  • selection_bold (default true) toggles the bold modifier.
  • selection_italic (default true) toggles the italic modifier.

When use_selection_fg is enabled, diff lines, filenames, commit hashes, times and authors are re-colored with selection_fg.

Status tree colors

You can configure different colours for selected and unselected items in the status tree by setting the following theme options. When the selected version is not provided, the colour falls back to the existing default (e.g. diff_file_added for added files), so the tree behaves as before unless you override one of these values.

(
    status_new_unselected_fg: Some("DarkGreen"),
    status_modified_unselected_fg: Some("DarkYellow"),
    status_deleted_unselected_fg: Some("DarkRed"),
    status_renamed_unselected_fg: Some("LightMagenta"),
    status_conflicted_unselected_fg: Some("Yellow"),
    status_typechange_unselected_fg: Some("Gray"),
    file_tree_path_selected_fg: Some("Cyan"),
    file_tree_path_unselected_fg: Some("DarkCyan"),
    file_tree_path_icon_selected_fg: Some("Cyan"),
    file_tree_path_icon_unselected_fg: Some("DarkCyan"),
)

The file_tree_path_* fields control how folder names and icons inside the status tree are rendered (selected vs. unselected). Setting them to dimmer colours makes the unselected rows appear "grayed out" without affecting selection styling.