-
Notifications
You must be signed in to change notification settings - Fork 619
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
Question: is it possible to create a custom color? #211
Comments
Hi @Integralist We only support 4-bit ANSI color codes. No 8-bit (256 colors) or RBG (16 million colors) are supported at this time. See https://notes.burke.libbey.me/ansi-escape-codes/ and https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences for more information. I doubt I have the time to add support for more colors, though it's something we could pursue in the future. |
Thanks @fatih for the links. I guess adding more colours is fine if defining your own isn't possible. I'll see if I can understand the code and what goes into defining your own colour (and if I can figure it out I'll open a PR). |
It looks like it's possible to add custom colors with RBG color codes, check this out: I plan to add a new API or extend the Readme so people know how to use it. |
Nice!! Thanks for the update |
👋🏻 Sorry, only just circled back around to this. What exactly are the first two inputs? The latter three appear to be RGB from my testing but if I modify the 2nd argument at all then nothing works, and if I modify the 1st argument to be anything other than 38 or 48 again nothing works 🤔 I mean, it's fine, I've been able to figure out what I need to do... c := color.New(color.Bold, 38, 2, 100, 0, 255).SprintFunc()
fmt.Printf("1: %s, 2: %s\n", c("prefix text"), "suffix text")
d := color.New(color.Bold, 48, 2, 100, 0, 255).SprintFunc()
fmt.Printf("1: %s, 2: %s\n", d("prefix text"), "suffix text") ...I'm just curious and would like to understand it. Thanks! |
Hi @Integralist I created a PR that provides ready to use API. Could you try it out and give any feedback you have there? #225 Thank you! |
👋🏻
I've been through the entire README and I couldn't find any way to create my own color.
Is this possible? If so could someone explain how.
Thanks!
The text was updated successfully, but these errors were encountered: