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 optional support for ansi_colours crate #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mina86
Copy link

@mina86 mina86 commented Jun 19, 2022

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.

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.

None yet

1 participant