I have implemented color output on the command line, very nice when running scripts on remote terminals via SSH.
I've used the Jansi library that supports both Unix and Windows terminals, and I've successfully tested it even on Windows cmd prompt.


It supports both named HTML colors and hex codes, and uses the nearest color on terminals that only support 16 or 256 colors. Auto-detection of features is done by Jansi, but can be overridden on the command line.
The code can be seen here: https://github.com/oxc/kolmafia/compare/upstream...color_cli
(UPDATE: I have attached both commits as patches as well)
(UPDATE: Patches can be downloaded here: https://github.com/oxc/kolmafia/compare/upstream...color_cli.patch )
You can test it yourself using the latest build here (built by GitHub Actions, in case you're concerned): https://github.com/oxc/kolmafia/releases/tag/latest
Comments and feedback welcome! Please let me know if changes are required to get this integrated into KoLmafia.
I've used the Jansi library that supports both Unix and Windows terminals, and I've successfully tested it even on Windows cmd prompt.


It supports both named HTML colors and hex codes, and uses the nearest color on terminals that only support 16 or 256 colors. Auto-detection of features is done by Jansi, but can be overridden on the command line.
The code can be seen here: https://github.com/oxc/kolmafia/compare/upstream...color_cli
(UPDATE: Patches can be downloaded here: https://github.com/oxc/kolmafia/compare/upstream...color_cli.patch )
You can test it yourself using the latest build here (built by GitHub Actions, in case you're concerned): https://github.com/oxc/kolmafia/releases/tag/latest
Comments and feedback welcome! Please let me know if changes are required to get this integrated into KoLmafia.
Last edited: