summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2022-02-17 14:31:12 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2022-02-17 14:31:12 +0200
commit3b553dd49d8f9adeda125ee6cc13f923611d308b (patch)
tree4cbc45f17c89f0d6b58131a0bff2f99b3aa9f3da /src
parent95cf0209c6a2357788167e01cc8eca2215244f36 (diff)
Tab button coloring with colored backgrounds
It's best to match the active tab button color to the document's background in case the latter is colored.
Diffstat (limited to 'src')
-rw-r--r--src/gmdocument.c3
-rw-r--r--src/prefs.h4
-rw-r--r--src/ui/labelwidget.c12
-rw-r--r--src/ui/root.c2
4 files changed, 18 insertions, 3 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 79deb861..a85e4b71 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -491,8 +491,7 @@ static iBool isNormalized_GmDocument_(const iGmDocument *d) {
491} 491}
492 492
493static enum iGmDocumentTheme currentTheme_(void) { 493static enum iGmDocumentTheme currentTheme_(void) {
494 return (isDark_ColorTheme(colorTheme_App()) ? prefs_App()->docThemeDark 494 return docTheme_Prefs(prefs_App());
495 : prefs_App()->docThemeLight);
496} 495}
497 496
498static void alignDecoration_GmRun_(iGmRun *run, iBool isCentered) { 497static void alignDecoration_GmRun_(iGmRun *run, iBool isCentered) {
diff --git a/src/prefs.h b/src/prefs.h
index 59c36a16..d988399e 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -193,3 +193,7 @@ iLocalDef float scrollSpeedFactor_Prefs(const iPrefs *d, enum iScrollType type)
193 iAssert(type >= 0 && type < max_ScrollType); 193 iAssert(type >= 0 && type < max_ScrollType);
194 return 10.0f / iMax(1, d->smoothScrollSpeed[type]) * (type == mouse_ScrollType ? 0.5f : 1.0f); 194 return 10.0f / iMax(1, d->smoothScrollSpeed[type]) * (type == mouse_ScrollType ? 0.5f : 1.0f);
195} 195}
196
197iLocalDef enum iGmDocumentTheme docTheme_Prefs(const iPrefs *d) {
198 return isDark_ColorTheme(d->theme) ? d->docThemeDark : d->docThemeLight;
199}
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c
index 3454014a..75cbbf3a 100644
--- a/src/ui/labelwidget.c
+++ b/src/ui/labelwidget.c
@@ -231,7 +231,17 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int
231 *bg = uiBackgroundUnfocusedSelection_ColorId; 231 *bg = uiBackgroundUnfocusedSelection_ColorId;
232 } 232 }
233 else { 233 else {
234 *bg = uiBackgroundSelected_ColorId; 234 const enum iGmDocumentTheme docTheme = docTheme_Prefs(prefs_App());
235 if ((docTheme == colorfulLight_GmDocumentTheme || docTheme == sepia_GmDocumentTheme) &&
236 !cmp_String(&d->widget.parent->id, "tabs.buttons")) {
237 *bg = (docTheme == sepia_GmDocumentTheme &&
238 colorTheme_App() == pureWhite_ColorTheme
239 ? tmBackground_ColorId
240 : tmBannerBackground_ColorId);
241 }
242 else {
243 *bg = uiBackgroundSelected_ColorId;
244 }
235 } 245 }
236 if (!isKeyRoot) { 246 if (!isKeyRoot) {
237 *bg = isDark_ColorTheme(colorTheme_App()) ? uiBackgroundUnfocusedSelection_ColorId 247 *bg = isDark_ColorTheme(colorTheme_App()) ? uiBackgroundUnfocusedSelection_ColorId
diff --git a/src/ui/root.c b/src/ui/root.c
index 6e187313..eeb5956f 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -1059,6 +1059,8 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) {
1059 updateNavBarIdentity_(navBar); 1059 updateNavBarIdentity_(navBar);
1060 } 1060 }
1061 setFocus_Widget(NULL); 1061 setFocus_Widget(NULL);
1062 makePaletteGlobal_GmDocument(document_DocumentWidget(doc));
1063 refresh_Widget(findWidget_Root("doctabs"));
1062 } 1064 }
1063 else if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd)) { 1065 else if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd)) {
1064 iWidget *widget = pointer_Command(cmd); 1066 iWidget *widget = pointer_Command(cmd);