picocli icon indicating copy to clipboard operation
picocli copied to clipboard

Add support for True Colours

Open bobtiernay-okta opened this issue 6 years ago • 2 comments

See https://gist.github.com/XVilka/8346728 for details.

bobtiernay-okta avatar Jan 13 '19 23:01 bobtiernay-okta

That would be a cool feature. There are several aspects to this:

Syntax Currently, the @|fg(0;5;0) text with red=0, green=5, blue=0 foreground|@ syntax is used for the 256 color palette (6x6x6 colors).

To keep things reasonably compact we could use a different bracket style for the true colors, for example:

# Use curly braces to designate 24-bit true colors?
@|fg{128;255;0} text with #80FF00 foreground|@
#or
@|fg{#80FF00} text with #80FF00 foreground|@

Detection Not all terminals support 24-bit true colors. Should picocli try to detect whether this is supported on the platform where it's running and if not, try to fall back to the 256 color palette? This could be a bit involved...

remkop avatar Jan 15 '19 07:01 remkop

Syntax Alternatives If just changing brackets is too cryptic, one alternative idea is to use a nested "rgb" tag:

# Use nested "rgb" tag to designate 24-bit true colors?
@|fg(rgb(128;255;0)) text with #80FF00 foreground|@
#or
@|fg(rgb(#80FF00)) text with #80FF00 foreground|@

or

# Introduce new "fg_rgb" and "bg_rgb" tags to designate 24-bit true colors?
@|fg_rgb(128;255;0) text with #80FF00 foreground|@
#or
@|fg_rgb(#80FF00) text with #80FF00 foreground|@

or

# Introduce new "fg_true" and "bg_true" tags for  24-bit true colors?
@|fg_true(128;255;0) text with #80FF00 foreground|@
#or
@|fg_true(#80FF00) text with #80FF00 foreground|@

remkop avatar Jan 15 '19 08:01 remkop