Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Colour Attributes

Aug
295
1
Trying to find a way to pick up a colour attribute from the tcc console screen example;

(A)pple A is green; pple is red; I want to automatically pick up the colour of A (green)
(B)anana B is yellow; anana is green; (parenthesis) only for clarity

_Without_ indexing the whole thing then inserting ansi sequences and hard coding it to a text file that
type would display with the correct colour attributes. (A)pple (B)anana etc...

Maybe a plugin exists ? Native tcc would be great nothing in the help file is jumping out at me besides
the hard coding route

Maybe a new feature in @readscr @readscr[4,3,1,a] where -a would pick up the attribute colour at position 4,3
 
I don't see any built-in way of doing it, but it wouldn't be hard to add. It would basically call ReadConsoleOutputAttribute(), in the same way that @READSCR calls ReadConsoleOutputCharacter().
 
I don't see any built-in way of doing it, but it wouldn't be hard to add. It would basically call ReadConsoleOutputAttribute(), in the same way that @READSCR calls ReadConsoleOutputCharacter().
There are some difficulties with today's enhanced console. I'm pretty sure that if normal attributes are 0x0007 (WHI on BLA), then reversed colors might be 0x0700 or 0x4007, the latter being normal combined with COMMON_LVB_REVERSE_VIDEO (0x4000).

That can be worked around. But ...

While it's possible to show 24-bit foreground colors (ESC[38;2;R;G;Bm) and 24-bit background colors (ESC[48;2;R;G;Bm), the best you're going to get by reading the attributes later is an approximation (a poor one) using the usual 0-15 foreground and 0-15 background.

Another thing that has made its way from Windows Terminal to the mainstream console is underlining (which I doubt you'll get from the attributes).

1628389365424.png


And there's likely to be more ... italics, strike-through, blinking
 
Last edited:
Back
Top