[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: terminalview black and white are inverted
[Thread Prev] | [Thread Next]
- Subject: Re: terminalview black and white are inverted
- From: Bruce Steers <bsteers4@xxxxxxxxx>
- Date: Wed, 15 May 2024 16:26:29 +0100
- To: Gambas Mailing List <user@xxxxxxxxxxxxxxxxxxxxxx>
On Sun, 12 May 2024 at 14:53, Bruce Steers <bsteers4@xxxxxxxxx> wrote: > According to xterm specs color codes ... > > *Ps* = 3 0 ⇒ Set foreground color to Black. > *Ps* = 3 1 ⇒ Set foreground color to Red. > *Ps* = 3 2 ⇒ Set foreground color to Green. > *Ps* = 3 3 ⇒ Set foreground color to Yellow. > *Ps* = 3 4 ⇒ Set foreground color to Blue. > *Ps* = 3 5 ⇒ Set foreground color to Magenta. > *Ps* = 3 6 ⇒ Set foreground color to Cyan. > *Ps* = 3 7 ⇒ Set foreground color to White. > *Ps* = 3 9 ⇒ Set foreground color to default, ECMA-48 3rd. > > and then 4 n for background, > > TerminalView does black and white inverted. 0 is 7 and 7 is 0 > > $ echo -e "\e[31;42m Red on Green \e[32;41m Green on Red \e[30;47m Black on white \e[ > 40;37m White on black \e[0m" > > see pic for result > > > Some investigating and it looks like it's translating 0 to TerminalView.Foreground and 7 to Background instead of being white and black. > > Is there a way to force 0 to be black and 7 be white? > > > It does not seem a common standard practice on all terminals > (checked on mate-terminal and konsole where it actually prints black or white) > > > Respects > > BruceS > > Looks like there is not a way, So I got around it by adding a TerminalView.AdaptiveForeground property. If True (the default) it uses original method. If false it does not do the Color.Invert() lines in TerminalScreen.DrawLine() If hView.AdaptiveForeground And If bDarkBackground Then iBg = Color.Invert(iBg, True) Then oddly by doing that i found the "bright" colors to actually be darker? so i had to add a method to change the values of TerminalScreen $aColor array 0-15 to adapt to original way or true color way. So my terminal now has an option to unset the AdaptiveForeground property and use 0=black and 7=white or be adaptive as per original code. (see screenshot) I think it should at least be a TerminalView option. i think a script could assume 0 is supposed to be black and thus rendering wrong shades.. Respects BruceS
Attachment:
Untitled.jpg
Description: JPEG image
terminalview black and white are inverted | Bruce Steers <bsteers4@xxxxxxxxx> |