Skip to content

chore: migrate PR #75 Add optional support for ansi_colours crate #5

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PThorpe92
Copy link
Owner

ogham/rust-ansi-term#80

Add Colour::approx_rgb and Colour::into_256 which convert RGB variant
into Fixed variant. This is useful when an application is running on
a terminal which does not support True Colour control codes. By using
the approximation the utility can fallback to using 256-colour palette
which is more widely supported.

Furthermore, add Colour::into_rgb method which performs conversion in
the opposite direction. Naturally, the results for the first 16
colours aren’t exactly reliable (since those colours can be configured
by the user) but indexes from the 6×6x6 cube or greyscale ramp will be
returned correctly.

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.

1 participant