diff --git a/src/applib/warning_colors.h b/src/applib/warning_colors.h index 1dd92f9..8ebc614 100644 --- a/src/applib/warning_colors.h +++ b/src/applib/warning_colors.h @@ -13,10 +13,37 @@ Copyright: #define WARNING_COLORS_H #include +#include #include "storage_property.h" +/// Check if a dark GTK theme is currently active +inline bool is_dark_theme_active() +{ + // Try to get the GTK settings to check for dark theme preference + Glib::RefPtr settings = Gtk::Settings::get_default(); + if (settings) { + // Check if the application prefers dark theme + bool prefer_dark = false; + settings->get_property("gtk-application-prefer-dark-theme", prefer_dark); + if (prefer_dark) { + return true; + } + + // Check theme name for common dark theme identifiers + Glib::ustring theme_name; + settings->get_property("gtk-theme-name", theme_name); + std::string theme_str = theme_name.lowercase(); + if (theme_str.find("dark") != std::string::npos || + theme_str.find("black") != std::string::npos) { + return true; + } + } + + return false; +} + /// Get colors for tree rows according to warning severity. /// \return true if the colors were changed. @@ -45,14 +72,16 @@ inline bool app_property_get_row_highlight_colors(WarningLevel warning, std::str /// \return true if the color was changed. inline bool app_property_get_label_highlight_color(WarningLevel warning, std::string& fg) { + bool dark_theme = is_dark_theme_active(); + if (warning == WarningLevel::Notice) { - fg = "#770000"; // very dark red + fg = dark_theme ? "#FF9999" : "#770000"; // lighter red for dark themes, very dark red for light themes } else if (warning == WarningLevel::Warning) { - fg = "#C00000"; // dark red + fg = dark_theme ? "#FF6666" : "#C00000"; // lighter red for dark themes, dark red for light themes } else if (warning == WarningLevel::Alert) { - fg = "#FF0000"; // red + fg = dark_theme ? "#FF4444" : "#FF0000"; // lighter/pink red for dark themes, bright red for light themes } return !(fg.empty()); diff --git a/src/gui/gsc_info_window.cpp b/src/gui/gsc_info_window.cpp index ae32000..d3d217b 100644 --- a/src/gui/gsc_info_window.cpp +++ b/src/gui/gsc_info_window.cpp @@ -2444,7 +2444,10 @@ gboolean GscInfoWindow::test_idle_callback(void* data) break; case SelfTestStatusSeverity::Error: if (!result_main_msg.empty()) { // Highlight in red - result_main_msg = ""s + result_main_msg + ""; + std::string alert_color; + // Use the same color as Alert level warnings for consistency + app_property_get_label_highlight_color(WarningLevel::Alert, alert_color); + result_main_msg = ""s + result_main_msg + ""; } result_details_msg += "\n"s + _("Check the Self-Test Log for more information."); break;