Closed nycex closed 1 year ago
It appears that urxvt
does not set the COLORTERM
variable to truecolor
, which is the only way how we can detect that a terminal emulator supports 24bit colors.
If you run pastel colorcheck
, you should be able to clearly determine whether or 24bit is supported.
Don't you see a warning in the top output of pastel pick
?
Well, I saw the warning and set the environment variable PASTEL_COLOR_MODE=24bit
. With this enabled, I get the output in st and urxvt I showed earlier. But now that I tried, when I set COLORTERM=24bit
or COLORTERM=truecolor
, then it shows correctly all the colors like in alacritty. Maybe there is a problem with the check for PASTEL_COLOR_MODE
Edit: Btw it just works for st, I just looked into it and urxvt doesn't even support truecolor to my surprise.
Maybe there is a problem with the check for
PASTEL_COLOR_MODE
It looks like there is, yes. I can reproduce it. Thank you for reporting this!
(Unrelated: in general, I suggest using a terminal which properly sets COLORTERM
. This will also enable true color support in many other programs).
Can you explain where to start? I can give this a go but I'm new to Rust. So I'll timebox it to not waste time.
@yugonline Sorry for the delay. Are you still interested in tackling this?
So to reproduce this, run:
COLORTERM="" PASTEL_COLOR_MODE=24bit pastel pick
It should show a smooth color palette (like for COLORTERM="truecolor" pastel pick
), and not with a restricted color depth, like in the screenshot above.
Next, look into src/cli/colorpicker.rs
and start here:
let mut canvas = Canvas::new(
width + 2 * config.padding,
width + 2 * config.padding,
Brush::from_environment(Stream::Stderr),
);
The problem is the Brush::from_environment(Stream::Stderr)
call which detects colordepth support by checking whether STDERR is an interactive terminal or not. Instead, it should also take into account environment variables. Search for COLORTERM
and PASTEL_COLOR_MODE
, to see how it is used in other places.
Sounds good I'll take a look!
When I run
even though when running this:
pastel pick
in st or urxvt, i get a output likefrom https://gist.github.com/XVilka/8346728, I get a smooth gradient:
In alacritty, it seems to work though:
![alacritty_output_image](https://user-images.githubusercontent.com/24685286/78463977-04995480-76e4-11ea-8422-e01ad938f32d.png)