Skip to content

Commit

Permalink
Merge pull request #1337 from pimutils/fix/color_lengths
Browse files Browse the repository at this point in the history
validate color before removing alpha values
  • Loading branch information
geier authored Feb 14, 2024
2 parents 9de3d98 + 2fad958 commit 0c9108e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions khal/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,9 +1324,9 @@ def _add_calendar_colors(

# In case the color contains an alpha value, remove it for urwid.
# eg '#RRGGBBAA' -> '#RRGGBB' and '#RGBA' -> '#RGB'.
if len(color) == 9:
if color and len(color) == 9 and color[0] == '#':
color = color[0:7]
elif len(color) == 5:
elif color and len(color) == 5 and color[0] == '#':
color = color[0:4]

entry = _urwid_palette_entry(
Expand Down

0 comments on commit 0c9108e

Please sign in to comment.