Skip to content

Colors and Themes #2293

Open
Open
@daedalus-rwx

Description

@daedalus-rwx

Scenario

I installed gitui on my bash. Unfortunately, the command bar display didn’t turn out well.
This happened because of some customizations to my terminal theme.

In the gitui documentation, the Color Theme section helped me, especially command_fg and cmdbar_bg.

In issues, some other posts also had some difficulty with the display (2286, 942) in the command bar.

Suggestion

Use the REVERSED modifier.

I don’t know the language or the framework, but I noticed that the styles in rs-tui accept modifiers, including REVERSED.

In bash, this modifier inverts the text and background colors.
If in rs-tui it does the same, this could help ensure the default theme of gitui is always readable.

An example of REVERSE in bash:

#!/bin/bash
BLUE='\033[0;34m'
RESET='\033[0m'
REVERSE='\033[7m'

echo -e "${BLUE}Normal blue text${RESET}"
echo -e "${BLUE}${REVERSE}Blue text with reverse style${RESET}"

Tip

In the bash example, using reverse should ensure good visibility in any theme.
This is because it’s common for the default blue to be used in text, regardless of the theme. Thus, blue is typically distinct from the background.
By applying the reverse style, the text takes on the background color. And the background takes on the blue color. This ensures the distinction between the two.

What Not to Change

This suggestion is not intended to eliminate the option of setting a custom theme in gitui.
The suggestion merely provides an alternative so that the default theme is possibly always readable.

References

An open project also focused on terminals that might bring some ideas is starship.rs.

The style strings section in advanced configurations shows how flexible the style settings are (https://starship.rs/advanced-config/#style-strings).

It seems that styles are specified as an array. For example, the array (inverted fg:blue) sets the font color to blue and then inverts the text and background colors.

This project has a comprehensive mapping of shells and terminals, as well as the limitations that may exist.

In gitui this would have some implications. This way of working likely doesn’t fit the Ron format.
And the formatting would be grouped by object. Ceasing to be:

command_fg: Color::White
cmdbar_bg: Color::Blue

It would be unified to:

command_bar: (inverted fg:blue)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions