nautilus-terminal icon indicating copy to clipboard operation
nautilus-terminal copied to clipboard

Customizable ansi colors?

Open GiovanniCardamone opened this issue 1 year ago • 1 comments

I am using dark gtk theme, and the default ansi color are not really eyes-friendly, would be nice to have configurable ansi color

example

Screenshot from 2022-09-05 15-57-08

Screenshot from 2022-09-05 15-58-38

GiovanniCardamone avatar Sep 05 '22 13:09 GiovanniCardamone

Hello,

Yes default VTE colors are ugly. It would be cool to add settings to customize them but I have no time / motivation to do it currently. I would accept a PR if someone is motivated enough to implement this. :)

NOTE: duplicate of #76

flozz avatar Sep 05 '22 15:09 flozz

Managed to hardcode them as a temporary solution. Just replace lines 327-343 from /usr/lib/python3.X/site-packages/nautilus_terminal/nautilus_terminal.py with:

foreground = Gdk.RGBA(
    fg_color[0] / 255.0,
    fg_color[1] / 255.0,
    fg_color[2] / 255.0,
    1,
)
background = Gdk.RGBA(
    bg_color[0] / 255.0,
    bg_color[1] / 255.0,
    bg_color[2] / 255.0,
    1,
)

palette_color_codes = ["#171421", "#C01C28", "#26A269", "#A2734C", "#12488B", "#A347BA", "#2AA1B3", "#D0CFCC",  # Palette colors
                       "#5E5C64", "#F66151", "#33D17A", "#E9AD0C", "#2A7BDE", "#C061CB", "#33C7DE", "#FFFFFF"]  # Bright counterparts

palette_colors = []
for color_code in palette_color_codes:
    if not color_helpers.is_color(color_code):
        color_code = 'White' # Invalid colors default to white

    color = color_helpers.parse_color_string(color_code)
    color = Gdk.RGBA(
        color[0] / 255.0,
        color[1] / 255.0,
        color[2] / 255.0,
        1
    )
    palette_colors.append(color)

self._ui_terminal.set_colors(foreground, background, palette_colors)

And restart it with nautilus -q.

Here I used the default GNOME colors from my terminal profile. Of course, change the palette_color_codes with the ones you want. The palette sizes must be 0, 8, 16, 232 or 256. Additionally, and as a personal preference I set the bold colors to bright with self._ui_terminal.set_bold_is_bright(True) at the end.

EDIT: Opened a pull request implementing this with an array of hexadecimals/color names here.

Acervans avatar Oct 02 '22 18:10 Acervans

The @Acervans PR will be released in the next Nautilus Temrinal version very soon :)

flozz avatar Oct 03 '22 13:10 flozz