Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate color before removing alpha values #1337

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading