Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: add RGB color support #4

Open
aremmell opened this issue Jul 16, 2023 · 0 comments
Open

Suggestion: add RGB color support #4

aremmell opened this issue Jul 16, 2023 · 0 comments

Comments

@aremmell
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant