Skip to content

Commit

Permalink
Merge pull request #1333 from kraasch/master
Browse files Browse the repository at this point in the history
In case alpha value exists remove it for urwid.
  • Loading branch information
geier authored Jan 29, 2024
2 parents acf3bae + 0059b65 commit d5e6ed3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion khal/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions khal/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d5e6ed3

Please sign in to comment.