diff options
author | Christian Geier <geier@lostpackets.de> | 2024-01-29 15:24:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-29 15:24:20 +0100 |
commit | d5e6ed39dc0ec5b8e822ec67450577b7d4f9ed59 (patch) | |
tree | c8768a645f29bdb86c9df828254cc0cc07adbbe9 | |
parent | acf3bae9d4db12cf421e5cb5f93ee758021a4dbb (diff) | |
parent | 0059b65621a3131e01bc53eba51c311b9ad2cba5 (diff) |
Merge pull request #1333 from kraasch/master
In case alpha value exists remove it for urwid.
-rw-r--r-- | khal/cli.py | 2 | ||||
-rw-r--r-- | khal/ui/__init__.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/khal/cli.py b/khal/cli.py index baf8c009..ef7dc5df 100644 --- a/khal/cli.py +++ b/khal/cli.py @@ -175,7 +175,7 @@ def build_collection(conf, selection): 'color': cal['color'], 'priority': cal['priority'], 'ctype': cal['type'], - 'addresses': cal['addresses'], + 'addresses': cal['addresses'] if 'addresses' in cal else '', } collection = khalendar.CalendarCollection( calendars=props, diff --git a/khal/ui/__init__.py b/khal/ui/__init__.py index 87057729..72cc9dcc 100644 --- a/khal/ui/__init__.py +++ b/khal/ui/__init__.py @@ -1321,6 +1321,14 @@ def _add_calendar_colors( color = collection.default_color else: color = cal['color'] + + # In case the color contains an alpha value, remove it for urwid. + # eg '#RRGGBBAA' -> '#RRGGBB' and '#RGBA' -> '#RGB'. + if len(color) == 9: + color = color[0:7] + elif len(color) == 5: + color = color[0:4] + entry = _urwid_palette_entry( attr_template.format(cal['name']), color, |