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

feature request: provide func(RGBColor) C16() Color #31

Closed
Delta456 opened this issue Nov 30, 2020 · 13 comments
Closed

feature request: provide func(RGBColor) C16() Color #31

Delta456 opened this issue Nov 30, 2020 · 13 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@Delta456
Copy link

As we have a function to round off true color to 256 colors, can we allow have a method to round off true color to 16 colors?

@inhere inhere self-assigned this Dec 1, 2020
@inhere inhere added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Dec 1, 2020
@Delta456
Copy link
Author

Delta456 commented Dec 1, 2020

You can look at how rich does it.

@inhere
Copy link
Member

inhere commented Dec 1, 2020

@Delta456 thanks

https://github.com/willmcgugan/rich/blob/0d2ed27835fc66c1d3f9a6f5b2eeac0cc688e585/rich/color.py#L468-L488

hi, This is Convert to 8-bit color from truecolor color.

8-bit color equals to 256 color, 16 colors is 4-bit color

@Delta456
Copy link
Author

Delta456 commented Dec 1, 2020

It is there in that file, my bad that I didn't link the correct one 😅

Side note: I am using your module for my module, see the dev branch

image

@inhere
Copy link
Member

inhere commented Dec 1, 2020

ok, thanks

@Delta456
Copy link
Author

Delta456 commented Dec 1, 2020

Please do tell when you can implement it, really need it.

@inhere
Copy link
Member

inhere commented Dec 1, 2020

hi @Delta456 you can use color.Print/color.Println instead of the fmt.Print/fmt.Println

https://github.com/Delta456/box-cli-maker/blob/df718f3ba00272fe470235e24f3e6931ab932238/box.go#L266
https://github.com/Delta456/box-cli-maker/blob/df718f3ba00272fe470235e24f3e6931ab932238/box.go#L298

color.PrintXX methods support render 256 and true colors on windows

@Delta456
Copy link
Author

Delta456 commented Dec 1, 2020

fmt.Println works for me in windows powershell, windows cmd and windows terminal.

@Delta456
Copy link
Author

Delta456 commented Dec 2, 2020

Found it https://github.com/radareorg/radare2/blob/master/libr/cons/rgb.c#L249-L271

@inhere inhere closed this as completed in 079365c Dec 2, 2020
@inhere
Copy link
Member

inhere commented Dec 2, 2020

hi @Delta456 added on 079365c

@Delta456
Copy link
Author

Delta456 commented Dec 2, 2020

@inhere omg thanks, can you do a new release for it? As I will not be able to use it for my module.

@inhere
Copy link
Member

inhere commented Dec 3, 2020

released https://github.com/gookit/color/releases/tag/v1.3.3

@Delta456
Copy link
Author

Delta456 commented Dec 3, 2020

Thank you so much ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants