Truly independent web browser
UI/Qt: Make the titles of inactive tabs quieter
Andreas Klingdba2b04eb08b
diff --git a/Documentation/UI/QuietDesign.md b/Documentation/UI/QuietDesign.mdindex 526c78d9087..0235bac29e1 100644--- a/Documentation/UI/QuietDesign.md+++ b/Documentation/UI/QuietDesign.md@@ -181,7 +181,7 @@ Numbers that change in place (zoom, counts, sizes, times) use tabular figures.| `sidebar` | Vertical tabs sidebar and rail | `#DCDCE0` | `#2E2E31` | `#CFCFD4` || `field` | Address field fill | Black 8% | White 8% | White + 1 px `#6E6E73` border || `text` | Titles, URL domain | `#1D1D1F` | `#F2F2F5` | `#000000` |-| `tab-title` | Inactive tab titles | `#3A3A40` | `#ACACB4` | `#3A3A40` |+| `tab-title` | Inactive tab titles | `#55555C` | `#8F8F97` | `#3A3A40` || `muted` | URL path, secondary text | `#5D5D64` | `#ACACB4` | `#3A3A40` || `icon` | Toolbar icons | `#3A3A40` | `#DCDCE1` | `#1D1D1F` || `disabled` | Disabled controls | `#B3B3B9` | `#5B5B61` | `#8E8E93` |@@ -261,7 +261,8 @@ bluer, lighter lavender, and its dark surfaces carry less tint than other themes| `strip` | `#110A20` || `toolbar` | `#2F2347` || `text` | `#F3F0FA` |-| `muted`, `tab-title` | `#B3AAC4` |+| `muted` | `#B3AAC4` |+| `tab-title` | `#958CA8` || `icon` | `#E2DCEF` || `disabled` | `#5E566E` || `field` | White 9% |diff --git a/UI/Qt/TabBar.cpp b/UI/Qt/TabBar.cppindex c4363b7c037..e67ce3f422a 100644--- a/UI/Qt/TabBar.cpp+++ b/UI/Qt/TabBar.cpp@@ -1516,8 +1516,17 @@ void TabBar::paintEvent(QPaintEvent*)auto title = tabText(index);// In an inactive window, the tabs' titles drop to the muted color.+ // NB: An unselected horizontal tab's title can be quieter than the muted color already, as in dark windows. It+ // takes the quieter of the two, so that it never grows louder as its window becomes inactive.+ auto const& chrome = Theme::chrome(*this);auto is_inactive = ChromeStyle::window_activity(*this) == ChromeStyle::WindowActivity::Inactive;- auto unselected_text_color = is_inactive ? Theme::chrome(*this).muted : (is_vertical ? Theme::chrome(*this).row_title : Theme::chrome(*this).tab_title);+ auto quieter_on_strip = [&](QColor const& a, QColor const& b) {+ auto strip_lightness = chrome.strip.lightnessF();+ return abs(a.lightnessF() - strip_lightness) <= abs(b.lightnessF() - strip_lightness) ? a : b;+ };+ auto unselected_text_color = is_vertical+ ? (is_inactive ? chrome.muted : chrome.row_title)+ : (is_inactive ? quieter_on_strip(chrome.tab_title, chrome.muted) : chrome.tab_title);auto selected_text_color = is_inactive ? Theme::chrome(*this).muted : Theme::chrome(*this).text;auto tab_text_color = ChromeStyle::mix(unselected_text_color, selected_text_color, selection);diff --git a/UI/Qt/Theme.cpp b/UI/Qt/Theme.cppindex 128a0d3c158..29350772c8c 100644--- a/UI/Qt/Theme.cpp+++ b/UI/Qt/Theme.cpp@@ -64,7 +64,7 @@ static ChromeColors const light_chrome {.field_focused = rgb(0xffffff),.text = rgb(0x1d1d1f),.muted = rgb(0x5d5d64),- .tab_title = rgb(0x3a3a40),+ .tab_title = rgb(0x55555c),.icon = rgb(0x3a3a40),.disabled = rgb(0xb3b3b9),.hover = rgba(0, 0, 0, 0.06),@@ -88,7 +88,7 @@ static ChromeColors const dark_chrome {.field_focused = rgb(0x3a3a3e),.text = rgb(0xf2f2f5),.muted = rgb(0xacacb4),- .tab_title = rgb(0xacacb4),+ .tab_title = rgb(0x8f8f97),.icon = rgb(0xdcdce1),.disabled = rgb(0x5b5b61),.hover = rgba(255, 255, 255, 0.06),@@ -112,7 +112,7 @@ static ChromeColors const private_chrome {.field_focused = rgb(0x3b2e55),.text = rgb(0xf3f0fa),.muted = rgb(0xb3aac4),- .tab_title = rgb(0xb3aac4),+ .tab_title = rgb(0x958ca8),.icon = rgb(0xe2dcef),.disabled = rgb(0x5e566e),.hover = rgba(255, 255, 255, 0.07),