Syntax hightlighting in openHAB console not readable

Hi,

I just installed a new openHAB instance via docker.
Nightly 2.40.

My productive setup is still running 2.1, so I was happy to see some improvements in the openHAB console.

But some commands are displayd dark blue on black. :frowning:

image

I conected via Putty from my WIndows 10 workstation and executed docker exec -it openhab /openhab/runtime/bin/client.

Is this behaviour expected?
Am I doing something wrong?
I changed some setting to my putty profile in the past, but only for the better.

The colors are controlled by putty. I don’t think there is much of anything you can do from the server side.

If you go into the PuTTY Window Colours menu go down to ANSI Blue and increase the Blue number. You can add some to RED and GREEN (the same value) to brighten it as well. You may want to play with ANSI Blue Bold as well. I’m not sure which. Make sure to save the session so it remembers the adjusted color the next time you connect. Note that changing these values do not affect any PuTTY session you currently have open. It only affects new sessions.

I don’t know why the default color scheme in PuTTY uses such a dark blue on a black background. KiTTY doesn’t use such a dark blue which is why I often use it instead. My favorite is to use Bash for Windows or the Ubuntu app from the Store. Then I don’t even need PuTTY. I can start with a Linux like environment from the get go.

I just logged in via Git Bash for Windows and got the same result.

My question is:
Do I need to change it or is this a general issue that effects everyone?

Is nobody else having this problem?

Same for me. I use the karaf rarely, so it doesn’t bother me…

Yup, also struggle with the darkness blue. :frowning:

Colours are set by Karaf and these are set to Apache Felix defaults. These can be overridden though, check out the relevant page for this here.

For openHAB:

Make a new .script file in $OPENHAB_USERDATA/etc/scripts (e.g. console.colours.script) with the settings to override e.g.:

HIGHLIGHTER_COLORS = "fu=32;1:bf=31;1"

These numbers must be ANSI colour codes and the key for what to change is in the link at the top of this post. In the example above, fu=32;1 turns functions bright green, and bf=31;1 turns bad functions bright red.

image

You can also use the HIGHLIGHTER_COLORS = ... line in the console directly if you want to play around with settings:

image

Note: Files in userdata/etc/scripts are kept between updates.

3 Likes

Shall we add such a setting as default in the distro? Feel free to come up with a PR with a suggestion for decent colors (orange and light blue as in the Paper UI are a good start!)!

1 Like

I’ve created an initial PR, unfortunately we’re stuck with the 8/16 colors of the ANSI spec so no orange unless someone uses a terminal that uses it instead of yellow (e.g. Ubuntu).

1 Like

Good to know. I just falsely assumed that karaf used the session defaults.

I almost always have the dark blue on black problem. You are not alone. I usually just set my background to a dark gray to deal with the problem, largely out of laziness (I don’t spend the time to find which setting corresponds with dark blue). But I rarely log into the karaf console so I guess I never noticed that it isn’t using the terminal defaults.

This helped me to avoid the problem in most (all?) cases.

image

That is why I was so irritated by the “wrong colors” of the openHAB console.

1 Like

I know how to change the Karaf Console printed (highlight) colors per the C:\openhab-3.0.2\userdata\etc\scripts\shell.colors.script file. Does anyone know how to change the background color from black to white. I’m running OH3.0.2 on Windows 10 and occasionally do screen shots, then print them. The black background makes for unreadable hardcopies. I also find black backgrounds hard to read.
Thanks for your help.

I don’t know how/if but why not select the text and copy/paste it into notepad prior to printing? Not only will it be more legible but you’ll be able to search and you won’t be limited to a single screen.

I think that should be configurable in your terminal. (Putty, PowerShell, ConEmu, …)

image