rtl_433 icon indicating copy to clipboard operation
rtl_433 copied to clipboard

Add darker colors for light terminal backgrounds

Open zuckschwerdt opened this issue 4 months ago • 1 comments

This addresses hard to read colors on light terminal backgrounds.

We use the COLORFGBG environment variable to detect a light background and then remove the bright/bold attribute from the foreground color.

If your terminal emulates bright colors with bold characters the light "theme" can be used to get non-bold (lighter) output.

Can be selected/tested by

  • for dark backgrounds COLORFGBG="15;0" rtl_433 …
  • for light backgrounds COLORFGBG="0;15" rtl_433 …

Modern terminals will already set this appropriately, check with echo $COLORFGBG

zuckschwerdt avatar Mar 04 '24 14:03 zuckschwerdt

This came up in #2823

@dreirund please review.

zuckschwerdt avatar Mar 04 '24 14:03 zuckschwerdt

Can you also please make a case for this unreadable time field. RTL_433-time

I had to patch it with:

--- a/src/output_file.c 2024-03-08 14:25:55
+++ b/src/output_file.c 2024-03-08 15:47:10
@@ -158,7 +158,7 @@
     if (!key || !*key)
         return TERM_COLOR_RESET;
     if (!strcmp(key, "tag") || !strcmp(key, "time"))
-        return TERM_COLOR_BLUE;
+        return TERM_COLOR_BRIGHT_WHITE;
     if (!strcmp(key, "model") || !strcmp(key, "type") || !strcmp(key, "id"))
         return TERM_COLOR_RED;
     if (!strcmp(key, "mic"))

BTW, the TFA-TwinPlus is totally out-of-wack. Another issue maybe later.

gvanem avatar Mar 08 '24 15:03 gvanem

Do you have something like COLORFGBG="15;4" in that terminal? Is the theme a Windows default or a selection or user setting?

zuckschwerdt avatar Mar 08 '24 19:03 zuckschwerdt

Do you have something like COLORFGBG="15;4" in that terminal?

I do not understand. I'm on Windows and COLORFGBG is a Gnome thing AFAICS.

Is the theme a Windows default or a selection or user setting?

A user setting from the WinCon settings dialogue: image

gvanem avatar Mar 09 '24 06:03 gvanem

That COLORFGBG is just a plain env var that some terminals set and support for that mechanism is easy. (I don't dare look into the ANSI-escape magic to make terminals report color configuration.)

You can only set a background color in WinCon (sorry, is that the name? Is it Windows Console?) and not the full color scheme, can you? Otherwise I'd recommend mapping the blue color to something like cyan maybe.

The idea is that you could set COLORFGBG fittingly and then rtl_433 could detect the bg color and remove that one color from the palette, e.g. replace it with white /fg.

zuckschwerdt avatar Mar 09 '24 20:03 zuckschwerdt

.. and not the full color scheme, can you?

I guess not. Have not tried ColorTool and rtl_433. But I have yet to try this patch here to see if it works on WinCon.

gvanem avatar Mar 09 '24 23:03 gvanem

@dreirund please review.

it seems to ignore COLORFGBG variable.

dreirund avatar Mar 26 '24 10:03 dreirund

@dreirund please review.

it seems to ignore COLORFGBG variable.

Now it works, we had a race condition here, seemed you just have added it to the code a few minutes ago when I was compiling and testing. Re-clone just gave me a very recent update of the code and now COLORFGBG="0;15" works.

dreirund avatar Mar 26 '24 10:03 dreirund