From 723715cb10cc66d0e3343c3bbe3f3d3cb6f15b34 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 14 Jan 2022 19:51:47 +0100 Subject: [PATCH] Use modern UI colors Follow the colors that modern desktops use when it comes to background, text and selections. --- vncviewer/fltk/theme.cxx | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/vncviewer/fltk/theme.cxx b/vncviewer/fltk/theme.cxx index 2c45c734..f89933a3 100644 --- a/vncviewer/fltk/theme.cxx +++ b/vncviewer/fltk/theme.cxx @@ -225,15 +225,43 @@ void init_theme() // Basic text size (10pt @ 96 dpi => 13px) FL_NORMAL_SIZE = 13; - // Select a background color that looks somewhat close to modern - // systems - Fl::background(220, 220, 220); + // Modern colors based on the default appearance of Windows 11, + // macOS 12 and GNOME 41 - // macOS has a slightly brighter default background though -#ifdef __APPLE__ - Fl::background(240, 240, 240); + // FIXME: Should get these from the system, + // Fl::get_system_colors() is unfortunately not very capable + // FIXME: Should also handle dark mode + +#if defined(WIN32) + // Windows 11 + Fl::foreground(26, 26, 26); + Fl::background(243, 243, 243); +#elif defined(__APPLE__) + // FIXME: Text is rendered slightly lighter than what we specify here + // for some odd reason. The target is (38, 38, 38). + Fl::foreground(28, 28, 28); + Fl::background(246, 246, 246); +#else + // GNOME + Fl::foreground(46, 52, 54); + Fl::background(246, 245, 244); #endif +#if defined(WIN32) + // Windows 11 default accent color + Fl::set_color(FL_SELECTION_COLOR, 0, 103, 192); +#elif defined(__APPLE__) + Fl::set_color(FL_SELECTION_COLOR, 0, 122, 255); +#else + // GNOME + Fl::set_color(FL_SELECTION_COLOR, 53, 132, 228); +#endif + + // The arrow on Fl_Return_Button gets a invisible, so let's adjust it + // to compensate for our lighter buttons + Fl::set_color(FL_LIGHT3, light_border(fl_color_average(FL_WHITE, FL_BACKGROUND_COLOR, 0.5))); + Fl::set_color(FL_DARK3, dark_border(fl_color_average(FL_WHITE, FL_BACKGROUND_COLOR, 0.5))); + // We will override the box types later, but changing scheme affects // more things than just those, so we still want to switch from the // default -- 2.39.5