Truly independent web browser
UI/Qt: Dim tab titles only when the window is inactive
Callum Law37b69e705f10
diff --git a/Documentation/UI/QuietDesign.md b/Documentation/UI/QuietDesign.mdindex 7c41d9d8c6f..8755bc15884 100644--- a/Documentation/UI/QuietDesign.md+++ b/Documentation/UI/QuietDesign.md@@ -181,8 +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 | `#55555C` | `#8F8F97` | `#3A3A40` |-| `muted` | URL path, secondary text | `#5D5D64` | `#ACACB4` | `#3A3A40` |+| `muted` | Tab titles in inactive windows, URL path, secondary text | `#5D5D64` | `#ACACB4` | `#3A3A40` || `icon` | Toolbar icons | `#3A3A40` | `#DCDCE1` | `#1D1D1F` || `disabled` | Disabled controls | `#B3B3B9` | `#5B5B61` | `#8E8E93` || `hover` | Hover fills | Black 6% | White 6% | Black 10% |@@ -262,7 +261,6 @@ bluer, lighter lavender, and its dark surfaces carry less tint than other themes| `toolbar` | `#2F2347` || `text` | `#F3F0FA` || `muted` | `#B3AAC4` |-| `tab-title` | `#958CA8` || `icon` | `#E2DCEF` || `disabled` | `#5E566E` || `field` | White 9% |diff --git a/UI/Qt/TabBar.cpp b/UI/Qt/TabBar.cppindex 411f40a2df6..1aa56e362b8 100644--- a/UI/Qt/TabBar.cpp+++ b/UI/Qt/TabBar.cpp@@ -1148,6 +1148,10 @@ void TabBar::paintEvent(QPaintEvent*)HashTable<Tab const*> tabs_with_cut_titles;auto title_line_height = QFontMetricsF(title_font).height();+ // In an inactive window, the tabs' titles drop to the muted color.+ auto const& chrome = Theme::chrome(*this);+ auto tab_text_color = ChromeStyle::window_activity(*this) == ChromeStyle::WindowActivity::Inactive ? chrome.muted : chrome.text;+if (auto rect = closing_tab_rect(); !rect.isEmpty()) {painter.save();// NB: The closing tab narrows from its end, which is rounded like the top corners of a tab. Its bottom reaches@@ -1420,23 +1424,6 @@ void TabBar::paintEvent(QPaintEvent*)contents_rect.setLeft(icon_rect.right() + HORIZONTAL_TAB_CONTENT_GAP);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 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);-- // NB: A title keeps its weight whether its tab is selected or not, so nothing reflows as only its color- // cross-fades.auto paint_title = [&] {painter.setFont(title_font);diff --git a/UI/Qt/Theme.cpp b/UI/Qt/Theme.cppindex 78947e69780..9ee546d9758 100644--- a/UI/Qt/Theme.cpp+++ b/UI/Qt/Theme.cpp@@ -64,12 +64,10 @@ static ChromeColors const light_chrome {.field_focused = rgb(0xffffff),.text = rgb(0x1d1d1f),.muted = rgb(0x5d5d64),- .tab_title = rgb(0x55555c),.icon = rgb(0x3a3a40),.disabled = rgb(0xb3b3b9),.hover = rgba(0, 0, 0, 0.06),.strip_hover = rgba(0, 0, 0, 0.06),- .row_title = rgb(0x3f3f45),.separator = rgb(0xbcbcc2),.divider = rgb(0xd2d2d6),.warning = rgb(0xb25d00),@@ -88,12 +86,10 @@ static ChromeColors const dark_chrome {.field_focused = rgb(0x3a3a3e),.text = rgb(0xf2f2f5),.muted = rgb(0xacacb4),- .tab_title = rgb(0x8f8f97),.icon = rgb(0xdcdce1),.disabled = rgb(0x5b5b61),.hover = rgba(255, 255, 255, 0.06),.strip_hover = rgba(255, 255, 255, 0.06),- .row_title = rgb(0xcfcfd6),.separator = rgb(0x3d3d42),.divider = rgb(0x0a0a0c),.warning = rgb(0xf2a33a),@@ -112,13 +108,11 @@ static ChromeColors const private_chrome {.field_focused = rgb(0x3b2e55),.text = rgb(0xf3f0fa),.muted = rgb(0xb3aac4),- .tab_title = rgb(0x958ca8),.icon = rgb(0xe2dcef),.disabled = rgb(0x5e566e),.hover = rgba(255, 255, 255, 0.07),// NB: The strip and the active tab are close in lightness here, so the normal hover would look like the active tab..strip_hover = rgba(255, 255, 255, 0.06),- .row_title = rgb(0xd5cee2),.separator = rgb(0x4a3d63),.divider = rgb(0x0f0a19),.warning = rgb(0xf2a33a),@@ -137,12 +131,10 @@ static ChromeColors const light_increased_contrast_chrome {.field_focused = rgb(0xffffff),.text = rgb(0x000000),.muted = rgb(0x3a3a40),- .tab_title = rgb(0x3a3a40),.icon = rgb(0x1d1d1f),.disabled = rgb(0x8e8e93),.hover = rgba(0, 0, 0, 0.10),.strip_hover = rgba(0, 0, 0, 0.10),- .row_title = rgb(0x1d1d1f),.separator = rgb(0x8e8e93),.divider = rgb(0x6e6e73),.warning = rgb(0x8a4700),@@ -161,12 +153,10 @@ static ChromeColors const dark_increased_contrast_chrome {.field_focused = rgb(0x000000),.text = rgb(0xffffff),.muted = rgb(0xd0d0d6),- .tab_title = rgb(0xd0d0d6),.icon = rgb(0xf2f2f5),.disabled = rgb(0x8a8a90),.hover = rgba(255, 255, 255, 0.14),.strip_hover = rgba(255, 255, 255, 0.14),- .row_title = rgb(0xf2f2f5),.separator = rgb(0x8a8a90),.divider = rgb(0x8a8a90),.warning = rgb(0xf2a33a),@@ -282,7 +272,7 @@ static ChromeColors derive_chrome(ChromeColors const& neutral, Optional<QColor>return colors;for (auto* surface : { &colors.strip, &colors.toolbar, &colors.sidebar, &colors.field_focused, &colors.separator, &colors.divider })tint(*surface, *tint_color, surface_saturation);- for (auto* ink : { &colors.text, &colors.muted, &colors.tab_title, &colors.icon, &colors.disabled, &colors.row_title })+ for (auto* ink : { &colors.text, &colors.muted, &colors.icon, &colors.disabled })tint(*ink, *tint_color, INK_TINT_SATURATION);return colors;}diff --git a/UI/Qt/Theme.h b/UI/Qt/Theme.hindex a67d63b2d52..3bcb46c65e8 100644--- a/UI/Qt/Theme.h+++ b/UI/Qt/Theme.h@@ -32,12 +32,10 @@ struct ChromeColors {QColor field_focused; // Address field fill while editingQColor text; // Titles, URL domainQColor muted; // URL path, secondary text- QColor tab_title; // Inactive tab titlesQColor icon; // Toolbar iconsQColor disabled; // Disabled controlsQColor hover; // Hover fillsQColor strip_hover; // Hover fill of controls on the tab strip- QColor row_title; // Unselected tab titles in the sidebarQColor separator; // Between inactive tabsQColor divider; // Chrome / page edgeQColor warning; // Crashed tab, lookalike URL