-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
Ensure color codes are valid at runtime if running in 16-color mode. #1167
Ensure color codes are valid at runtime if running in 16-color mode. #1167
Conversation
22d2b8e
to
c47aee4
Compare
c47aee4
to
fd18000
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srdeotarse Thanks for looking into this 👍
I've left some feedback inline. We'll likely squash the test commit with the other one when merging.
Please do check the commit style guidelines in the README :)
You may also find installing gitlint useful, if you haven't already.
(16, "zt_dark"), | ||
(16, "gruvbox_dark"), | ||
(16, "gruvbox_light"), | ||
(16, "zt_light"), | ||
(16, "zt_blue"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is useful to use an existing theme as a basis for a test, but I'm not sure we benefit from testing against all the existing themes.
Instead, I'd suggest exploring different Color
sets, eg. ensuring that a range of names work, as well as what output one gets if multiple colors in Color
are invalid.
d9d4925
to
4b5b990
Compare
zulipterminal/config/themes.py
Outdated
""" | ||
theme_colors = THEMES[theme_name].Color | ||
failure_text = [] | ||
new_line = "\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can join the errors with this instead.
zulipterminal/config/themes.py
Outdated
color_code = c.value.split()[0] | ||
if color_code not in valid_16_color_codes: | ||
invalid_16_color_code = str(c.name) | ||
invalid_16_color_code_name = str(c.value).split()[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just color_code
?
9d47314
to
3718578
Compare
These were previously only used in tests; this change allows use at runtime.
Adds validate_colors function to check invalid 16code color names. Tests added. Fixes zulip#1158.
138a456
to
5ab15bd
Compare
@srdeotarse Thanks for the update; as per discussion in the stream I slightly adjusted some text and added a commit to tidy slightly. Merging now 🎉 |
What does this PR do?
In
/zulip-terminal/zulipterminal/config/themes.py
code is added ingenerate_theme
function to check if valid color codes are used in color files for specific themes. For eg. (colors_gruvbox.py
forgruvbox_dark.py
theme)Fixes #1158
Tested?
Commit flow
Notes & Questions
Interactions
Visual changes