icinga2 icon indicating copy to clipboard operation
icinga2 copied to clipboard

Console::SetWindowsConsoleColor(): don't set black background

Open Al2Klimov opened this issue 4 years ago • 12 comments

... but let it as-is.

Please see the commit messages.

Al2Klimov avatar Jul 14 '21 16:07 Al2Klimov

Before

Bildschirmfoto 2021-07-14 um 18 17 54

After

Bildschirmfoto 2021-07-14 um 18 22 02

Al2Klimov avatar Jul 14 '21 16:07 Al2Klimov

@cla-bot check

Al2Klimov avatar Aug 04 '21 11:08 Al2Klimov

Bildschirmfoto 2023-05-19 um 17 55 20

yhabteab avatar May 19 '23 15:05 yhabteab

Ah, a Schrödinger's approval. 😁

Al2Klimov avatar May 22 '23 08:05 Al2Klimov

In nodewizardcommand.cpp, there are a few instances that only do std::cout << ConsoleColorTag(Console_Bold), so that might still mess up some of the colors (from looking at the code, I think it might set the foreground color to black).

How? operator<<(std::ostream&,const ConsoleColorTag&) calls Console::SetWindowsConsoleColor() which I've changed here.

Al2Klimov avatar May 22 '23 12:05 Al2Klimov

If the following if isn't executed (which it shouldn't if you don't set any Console_Foreground* flags but any other flags like Console_Bold):

https://github.com/Icinga/icinga2/blob/0303bcfd66aec666cee9b518ab4b833d63c94433/lib/base/console.cpp#L141-L142

So none of the FOREGROUND_* flags are added to attrs, which should result in black being the foreground color (given that case Console_ForegroundBlack does attrs |= 0).

julianbrost avatar May 22 '23 12:05 julianbrost

I see... a badly described bad design decision.

Al2Klimov avatar May 22 '23 12:05 Al2Klimov

I don't understand why you're closing this now. There's obviously something broken, by now, multiple persons spent time on this and it doesn't look like we are very far from something working.

julianbrost avatar May 22 '23 12:05 julianbrost

To me the only solution looks very far.

Al2Klimov avatar May 22 '23 16:05 Al2Klimov

Before

Bildschirm­foto 2023-05-22 um 18 11 55

After

Bildschirm­foto 2023-05-22 um 18 40 13

Al2Klimov avatar May 22 '23 16:05 Al2Klimov

Change background color -> Blue:

So it doesn't work if you change it at runtime?

Al2Klimov avatar Jan 03 '24 11:01 Al2Klimov