peterbrittain / asciimatics

A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
Apache License 2.0
3.61k stars 238 forks source link

DarkGray access on Windows/Powershell? #363

Closed ymyke closed 1 year ago

ymyke commented 1 year ago

When I run this script in my Powershell: https://stackoverflow.com/questions/20541456/list-of-all-colors-available-for-powershell I can see there is a DarkGray color in my system.

However, asciimatics doesn't have that in the Screen class (or anywhere else according to my search). Is there any way to access DarkGray somehow?

(Incidentally, do you know a shell that supports more colors than Powershell on Windows? Or is the limitation underlying?)

ymyke commented 1 year ago

BTW, the script mentioned in the SO post lists many other colors, but they are identical to some of the colors that are already supported in asciimatics. At least in my case. That's why I don't mention them. DarkGray is the only one that would add something new.

peterbrittain commented 1 year ago

There are 16 basic colours in the classic windows console, being split into dark and light variants of the 8 standard (red, green, yellow, blue, magenta, cyan, black and white). Dark white (i.e colour 7 if you use zero indexed counting in C) and light black (i.e. colour 8) make the shades of grey.

In the win32 world, you get the lighter versions by specifying a foreground or background intensity. This broadly maps to the use of A_BOLD in asciimatics. Unfortunately, that only works for foreground colours ascthere isn't a cross platform way of setting background attributes.

peterbrittain commented 1 year ago

There have been recent changes to the Wimdows console to support more than 16 colours. This requires a different use of the console API as tracked by https://github.com/peterbrittain/asciimatics/issues/197.

ymyke commented 1 year ago

Super, thanks for the hint w/ A_BOLD.

197 is still work in progress, do I understand correctly?

peterbrittain commented 1 year ago

It's a possible future enhancement. I'm not currently working on it.

A simpler enhancement to get access to all 16 background colours (if that's what you need) on Windows would be just to make thwe Windows Screen understand all 16 system colours, i.e. add definitions for all the intense colours and give them new colour constants (e.g. COLOUR_BRIGHT_RED).

Interested in making that change (with a little help)?

ymyke commented 1 year ago

I was looking for the dark gray fg color which was not accessible to me. I'm happy with that for the moment.

But I'll get back if things should change.

BTW, I'm ending up using asciimatics in a very raw/direct (and probably unsupported) way for what I'm building. Might contribute with a sample on how to do that if that sounds interesting.

peterbrittain commented 1 year ago

I'm always interested in how other people use this project... Feel free to reach out when you have something.