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

Add 256 colors support #72

Merged
merged 1 commit into from
Aug 10, 2020
Merged

Add 256 colors support #72

merged 1 commit into from
Aug 10, 2020

Conversation

dalance
Copy link
Contributor

@dalance dalance commented Aug 3, 2020

This PR adds Color::Color256(u8) for 256 colors support like below:

image

@pksunkara pksunkara merged commit 4638d56 into console-rs:master Aug 10, 2020
dtolnay pushed a commit to dtolnay-contrib/console that referenced this pull request Feb 4, 2022
This branch adds color-coding for durations based on their unit, as
described in console-rs#71. The colors are a simple gradient, from picoseconds to
whole seconds.

Currently, the unit is detected by formatting the value using the
`fmt::Debug` impl for `Duration`, and looking at the last two characters
to determine the unit. Admittedly, this is kind of janky, but it seemed
like re-implementing all of the `Duration` formatting logic would be
worse.

Right now, this assumes the terminal supports the ANSI 256-color
palette. I'm working on an additional change to detect what color
palettes the terminal supports and select colors based on that, but I
figured I'd do that in a separate PR.

Here's a little example screenshot:

![image](https://user-images.githubusercontent.com/2796466/126686509-e5fe37f7-82e7-422e-a486-c8d60e97ed6a.png)

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
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

Successfully merging this pull request may close these issues.

None yet

2 participants