adamdruppe / arsd

This is a collection of modules that I've released over the years. Most of them stand alone, or have just one or two dependencies in here, so you don't have to download this whole repo.
http://arsd-official.dpldocs.info/arsd.html
531 stars 128 forks source link

terminal: support more colors (all the colors?) #379

Closed ernest-bruce closed 1 year ago

ernest-bruce commented 1 year ago

could use custom colors for background and foreground? . by this i mean that, in addition to the color constants, i would appreciate the ability to specify colors using the 0..255 range for red, gree, blue

adamdruppe commented 1 year ago

this function does that:

http://arsd-official.dpldocs.info/arsd.terminal.Terminal.setTrueColor.html

ernest-bruce commented 1 year ago

oh, wow! . that was quick!

i just discovered it and was preparing what to say about it here (i have been learning about each symbol of the Terminal struct in the past couple of hours) . i also saw that the terminal may not support all the colors (my web search and your code comments prepared me for that eventuality) . but i had to find out for myself:

RGB orange; 
orange.r=0; orange.g=128; orange.b=128;
terminal.setTrueColor(orange, orange);

instead of orange, Terminal (macOS) displays cyan

when i use terminal.color(Color.blue, Color.blue); i get blue

seems like my all·the·colors dream has been shattered by the infrastructure

blue not_orange
adamdruppe commented 1 year ago

Orange is a combination of red and green, not green and blue.

The standard definition for orange is:

RGB(255,165,0)

which might work

ernest-bruce commented 1 year ago

omg! . it does work

this is important for me because i am working on an English·parsing tool that highlights sentence structure . color is the main mechanism through which i plan on showing parts of speech and sentence components to people

also, orange is my favorite color

thank you very much, Mr Ruppe!

ernest-bruce commented 1 year ago
Screen Shot 2023-04-05 at 14 50 05

this led me astraty:

Screen Shot 2023-04-05 at 14 50 55