From 7bbe856ba4115d7dc57054ecc34ebbfc5a027f13 Mon Sep 17 00:00:00 2001 From: forbes Date: Sun, 15 Feb 2026 03:01:46 -0600 Subject: [PATCH] fix(ui): adaptive text color for breadcrumb pills (#200) Use WCAG relative luminance to choose dark or light text color based on pill background brightness. Bright backgrounds (Green, Yellow, Mauve, Teal, Peach) now get dark text (#1e1e2e) instead of the previous fixed light text (#cdd6f4) that caused poor contrast. Closes #200 --- src/Gui/BreadcrumbToolBar.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Gui/BreadcrumbToolBar.cpp b/src/Gui/BreadcrumbToolBar.cpp index f6fd3de4c8..00852520ae 100644 --- a/src/Gui/BreadcrumbToolBar.cpp +++ b/src/Gui/BreadcrumbToolBar.cpp @@ -42,7 +42,13 @@ using namespace Gui; static QString chipStyle(const QString& bgHex) { QColor bg(bgHex); - QColor textColor(QStringLiteral("#cdd6f4")); // Catppuccin Text + + // Choose text color based on background luminance (WCAG relative luminance) + // Dark text on bright backgrounds, light text on dark backgrounds + double luminance = 0.2126 * bg.redF() + 0.7152 * bg.greenF() + 0.0722 * bg.blueF(); + QColor textColor(luminance > 0.5 + ? QStringLiteral("#1e1e2e") // Catppuccin Base (dark) + : QStringLiteral("#cdd6f4")); // Catppuccin Text (light) return QStringLiteral( "QToolButton {" -- 2.49.1