onevcat/Rainbow

ANSI 256 Support?

dannys42 opened this issue ยท 8 comments

Thanks for the great library! Any chance of supporting 256 colors? (like https://github.com/junegunn/ansi256/)

Not yet currently. But that is interesting. I will try to see what can be done.

Per #49 merged, now you can use an 8-bit or 24-bit color (which is limited supported) by using this code:

"hello".bit8(196)
"hello".bit24((255, 0, 0))

A new tag will be applied later. Before that, I have some other plans for this library. Before all prepared, if you need this API, feel free to pin it to the master branch for a while. :)

Woohoo! Thanks!

Version 4.0 was just released and containing this change.

By the way, even the Hex color is supported and it will be converted to an approximated 8-bit color for you. Check the README for more.

Thanks! I understand the motivation for calling it "bit", but would "rgb" make more sense? Hmm.. maybe it doesn't make sense for 8-bit.. I only mention because while "rgb" is very common, it's not always the order people use.

@dannys42

Naming is so hard.

Obviously it is not rgb, which lies in every aspect so it should be out. ansi might be a good name. Now I am following the wiki page here (https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to give it a bit8 as name (which receives a UInt8, at least it is more or less telling the truth.)

If you like rgb, it should be always easy enough to add an extension. But for now, let me keep it as is until a better name shows up! ๐Ÿ˜‚