Add config for tab colors for odd/even sel. tabs.
This commit is contained in:
parent
957116658d
commit
f96de5a598
@ -23,6 +23,12 @@ Added
|
||||
- New setting `ui -> hide-wayland-decoration` to hide the window decoration
|
||||
when using wayland.
|
||||
|
||||
Changed
|
||||
~~~~~~~
|
||||
|
||||
- The `colors -> tabs.bg/fg.selected` option got split into
|
||||
`tabs.bg/fg.selected.odd/even`.
|
||||
|
||||
Fixed
|
||||
~~~~~
|
||||
|
||||
|
@ -324,10 +324,12 @@ class ConfigManager(QObject):
|
||||
RENAMED_OPTIONS = {
|
||||
('colors', 'tab.fg.odd'): 'tabs.fg.odd',
|
||||
('colors', 'tab.fg.even'): 'tabs.fg.even',
|
||||
('colors', 'tab.fg.selected'): 'tabs.fg.selected',
|
||||
('colors', 'tab.fg.selected'): 'tabs.fg.selected.odd',
|
||||
('colors', 'tabs.fg.selected'): 'tabs.fg.selected.odd',
|
||||
('colors', 'tab.bg.odd'): 'tabs.bg.odd',
|
||||
('colors', 'tab.bg.even'): 'tabs.bg.even',
|
||||
('colors', 'tab.bg.selected'): 'tabs.bg.selected',
|
||||
('colors', 'tab.bg.selected'): 'tabs.bg.selected.odd',
|
||||
('colors', 'tabs.bg.selected'): 'tabs.bg.selected.odd',
|
||||
('colors', 'tab.bg.bar'): 'tabs.bg.bar',
|
||||
('colors', 'tab.indicator.start'): 'tabs.indicator.start',
|
||||
('colors', 'tab.indicator.stop'): 'tabs.indicator.stop',
|
||||
|
@ -973,13 +973,21 @@ def data(readonly=False):
|
||||
SettingValue(typ.QtColor(), 'darkgrey'),
|
||||
"Background color of unselected even tabs."),
|
||||
|
||||
('tabs.fg.selected',
|
||||
('tabs.fg.selected.odd',
|
||||
SettingValue(typ.QtColor(), 'white'),
|
||||
"Foreground color of selected tabs."),
|
||||
"Foreground color of selected odd tabs."),
|
||||
|
||||
('tabs.bg.selected',
|
||||
('tabs.bg.selected.odd',
|
||||
SettingValue(typ.QtColor(), 'black'),
|
||||
"Background color of selected tabs."),
|
||||
"Background color of selected odd tabs."),
|
||||
|
||||
('tabs.fg.selected.even',
|
||||
SettingValue(typ.QtColor(), '${tabs.fg.selected.odd}'),
|
||||
"Foreground color of selected even tabs."),
|
||||
|
||||
('tabs.bg.selected.even',
|
||||
SettingValue(typ.QtColor(), '${tabs.bg.selected.odd}'),
|
||||
"Background color of selected even tabs."),
|
||||
|
||||
('tabs.bg.bar',
|
||||
SettingValue(typ.QtColor(), '#555555'),
|
||||
|
@ -409,17 +409,25 @@ class TabBar(QTabBar):
|
||||
for idx in range(self.count()):
|
||||
tab = QStyleOptionTab()
|
||||
self.initStyleOption(tab, idx)
|
||||
|
||||
bg_parts = ['tabs', 'bg']
|
||||
fg_parts = ['tabs', 'fg']
|
||||
if idx == selected:
|
||||
bg_color = config.get('colors', 'tabs.bg.selected')
|
||||
fg_color = config.get('colors', 'tabs.fg.selected')
|
||||
elif idx % 2:
|
||||
bg_color = config.get('colors', 'tabs.bg.odd')
|
||||
fg_color = config.get('colors', 'tabs.fg.odd')
|
||||
bg_parts.append('selected')
|
||||
fg_parts.append('selected')
|
||||
|
||||
if idx % 2:
|
||||
bg_parts.append('odd')
|
||||
fg_parts.append('odd')
|
||||
else:
|
||||
bg_color = config.get('colors', 'tabs.bg.even')
|
||||
fg_color = config.get('colors', 'tabs.fg.even')
|
||||
bg_parts.append('even')
|
||||
fg_parts.append('even')
|
||||
|
||||
bg_color = config.get('colors', '.'.join(bg_parts))
|
||||
fg_color = config.get('colors', '.'.join(fg_parts))
|
||||
tab.palette.setColor(QPalette.Window, bg_color)
|
||||
tab.palette.setColor(QPalette.WindowText, fg_color)
|
||||
|
||||
try:
|
||||
indicator_color = self.tab_data(idx, 'indicator-color')
|
||||
except KeyError:
|
||||
|
Loading…
Reference in New Issue
Block a user