bash-prompt-generator icon indicating copy to clipboard operation
bash-prompt-generator copied to clipboard

Suggestion: add RGB color support

Open aremmell opened this issue 11 months ago • 0 comments

Even though my terminal reports that it's xterm-256color, it supports RGB TrueColor. Every modern terminal I've tested with do as well. The format is similar to what you're already using. You could just add a color picker wheel and you'd be done.

The syntax is

\e[<attr>;<fg|bg>;2;<rrr>;<ggg>;<bbb>mHello, world\e[0m

Where:

  • attr is the normal/bold/emphasis, etc.
  • fg is 38, bg is 48 (to set default fg or bg, use 39 and 49, and omit the colors)
  • 2 is the RGB color mode
  • <rrr>;<ggg>;<bbb> is an RGB tuple: 80;201;45

You can also chain foreground and background commands together:

\e[0;38;2;80;201;45;48;2;0;0;0\0m

This is example random (literally) colors in RGB mode from my logging library:

Screenshot 2023-07-16 at 16 11 02

aremmell avatar Jul 16 '23 22:07 aremmell