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

image/color.Color to tcell.Color conversion function #450

Closed
spenserblack opened this issue Apr 22, 2021 · 0 comments
Closed

image/color.Color to tcell.Color conversion function #450

spenserblack opened this issue Apr 22, 2021 · 0 comments

Comments

@spenserblack
Copy link
Contributor

@spenserblack spenserblack commented Apr 22, 2021

I think it would be useful to add a function that takes a color.Color and returns a tcell.Color. Although it isn't too difficult to implement (just take the RGB values from color.Color and do some slight conversion), it adds extra steps to the user that can probably be done by this library.

It can also be confusing for users trying to manually convert, since tcell.NewRGBColor takes type int32 but only accepts the range 0-255, while image/color.Color returns type uint32. This can make the user think they can simply convert the uint32 value to int32, but this isn't necessarily true. For example, in a project I'm working on, I thought I could do a simple int32(uint32Value), but found out that I also had to bit shift the uint32 values to make it in the range 0-255.

Apologies if this already exists, but I didn't see it anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant