Merge pull request #72 from The-Compiler/color-overrides

Implement per-tag color overrides
This commit is contained in:
Aleks Kissinger 2024-09-17 18:21:24 +01:00 committed by GitHub
commit b1d1e43fcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View File

@ -131,6 +131,11 @@ class SearchModel(QAbstractItemModel):
font.setBold(True)
return font
elif role == Qt.ItemDataRole.ForegroundRole:
for tag in settings.search_color_overrides.keys() & thread_d['tags']:
if col in settings.search_color_overrides[tag]:
color = settings.search_color_overrides[tag][col]
return QColor(color)
color = 'fg_' + col
unread_color = 'fg_' + col + '_unread'
flagged_color = 'fg_' + col + '_flagged'

View File

@ -338,3 +338,26 @@ Example configuration using this feature to highlight markdown syntax:
pygments_css = pygments.formatters.HtmlFormatter(style="gruvbox-dark").get_style_defs()
dodo.settings.message_css += pygments_css.replace("{", "{{").replace("}", "}}")
"""
search_color_overrides = {}
"""A dictionary mapping tags to color dictionaries.
The color dictionaries map columns to override colors.
The available columns are:
- date
- from
- subject
- tags
For example, to show a red subject for messages tagged 'urgent',
using the built-in Gruvbox palette:
.. code-block:: python
dodo.settings.search_color_overrides = {
'urgent': {
'subject': dodo.themes.gruvbox_p['neutral_red'],
}
}
"""