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

16-color fallback mode #21

Open
neersighted opened this issue Dec 4, 2018 · 9 comments
Open

16-color fallback mode #21

neersighted opened this issue Dec 4, 2018 · 9 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@neersighted
Copy link

A fallback to 16 colors would be great for those of us who use a terminal with a set color scheme locally, and rely on true color for unconfigured terminals or over ssh.

@sharkdp
Copy link
Owner

sharkdp commented Dec 5, 2018

Thank you for the feedback!

How would this work? There is no fixed specification for those 16 colors, right? We wouldn't have any control over how the output looks like.

a terminal with a set color scheme locally, and rely on true color for unconfigured terminals or over ssh.

I don't quite understand. What does "terminal over ssh" mean? Aren't you still limited by your local terminal if you SSH anywhere else?

@neersighted
Copy link
Author

There's no fixed specification, but most color schemes have a version for 16 color terminals. I'd prefer to have a pair of [rgb, 16-color index] in each theme, thus falling back to a configured terminal.

There are situations where I cannot rely on truecolor, such as SSH from mobile devices, or connections over mosh. I find it useful to fall back to a conventional colorscheme instead of corrupting the terminal.

@sharkdp
Copy link
Owner

sharkdp commented Dec 5, 2018

There's no fixed specification, but most color schemes have a version for 16 color terminals.

Ok, that makes sense. Although we would have to rely on the users to have the same color scheme configured in their terminal (which they need anyway for a suitable background color).

There are situations where I cannot rely on truecolor, such as SSH from mobile devices, or connections over mosh. I find it useful to fall back to a conventional colorscheme instead of corrupting the terminal.

Oh I see, if you are connecting to your machine from another terminal.

How would we detect that? Can we get correct values of $COLORTERM/$TERM within an SSH session?

@neersighted
Copy link
Author

The proper way is to use terminfo (try tput colors on a system with modern ncurses and TERM set to xterm-direct, for instance). Personally, I'd prefer to have it configured via a flag, so I can attach my own logic to the process.

@neersighted
Copy link
Author

(Making the color mode tri-state and adding a 4-bit mode would be perfect)

@neersighted
Copy link
Author

Also, themes could have automatic fallback support if they used the standard ANSI color names for 16 of their keys: black, red, green, blue, cyan, magenta, yellow, white (and bright variants of each)

@sharkdp sharkdp added enhancement New feature or request help wanted Extra attention is needed labels Feb 28, 2020
@pickfire
Copy link

pickfire commented Nov 4, 2020

I would also like to see this since I wanted to use the default color of the terminal rather than the colors specified manually.

@chtenb
Copy link

chtenb commented Mar 30, 2022

Yes I would like this feature too. I think all we would need is a way to refer to a ansi colors in the theme format. Right now it seems we can only refer to "fixed" colors like

colors:
  background_color: '161821'

If we could to something like

colors:
  background_color: -1
  white: 1
  red: 2

then we could ship a theme that would only use the ansi colors.

@setpill
Copy link

setpill commented Aug 3, 2024

+1 on this feature, with the addition that I'd like to be able to use a 256 colour palette, not just a 16 colour palette. Rationale being that I use a base16 theme in "compatible" mode (ie. using 22 colours), and I'd love if my LS_COLORS could respect my terminal colours, also e.g. when I switch theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants