Open SOF3 opened 2 years ago
RESET doesn't only remove colours. We would need something like #4364 to implement this without breaking anything.
To provide more detailed context on my reasons for stalling this:
There is currently no convenient way to go back to the base colour for log messages (or indeed anything else). This has been worked around in many places by using WHITE formatting codes in command outputs when strings contain coloured parts. RESET is not suitable for such cases, because it will unconditionally revert back to whatever the default text colour is (for example, on Git Bash, it's usually an off-white colour).
This could be addressed if we had some way to rebase coloured text, such that RESET was replaced by a sequence of formatting items introduced by the caller. For example, rebase(TextFormat::YELLOW, TextFormat::RED . "Hello " . TextFormat::RESET . "World")
would produce a red Hello
and a yellow World
, rather than a grey World
(or whatever the default terminal colour is).
Issue description
PocketMine hardcodes
WHITE
andGRAY
forinfo
anddebug
. https://github.com/pmmp/PocketMine-MP/blob/59de045ecbacfb9acc297e75170819727d68ae09/src/utils/MainLogger.php#L114-L121It looks like this on Black-on-White terminals:
While terminal themes are responsible for remapping colors to something appropriate in their palette, black and white are generally not mapped because it might deliberately need to be white/black.
But it just doesn't make sense to render normal info messages as
WHITE
instead of the default (RESET
) color. Why do we need to hardcode them?OS and versions
Plugins
Crashdump, backtrace or other files