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

Improve support for different color depths (16, 1) #563

Merged
merged 2 commits into from
Apr 19, 2020

Conversation

neiljp
Copy link
Collaborator

@neiljp neiljp commented Mar 27, 2020

Currently we just run with 256 colors and assume the user system supports that.

This is reasonable to a great degree, but urwid supports palettes from 1 (monochrome), 16, and others too. The first commit in this PR enables specifying color depths of 16 or 256 on the command line, defaulting to 256, which may help with reproducing color rendering issues. The subsequent commit is a minor change which makes the 256-bit stream colors be rendered with a color; I'm open to dropping this commit as we could do something different.

The last three commits extend the first commit to allow running in monochrome, add reasonable defaults in the default theme, and finally overwrite the monochrome settings in all themes at run-time. I can't imagine we'll actually want monochrome themes, which is why I made the final change, and these commits could be squashed/dropped and combined with other work to just have empty values in the monochrome settings in themes if this looks good. I was using it just now 👍

@zulipbot zulipbot added the size: XL [Automatic label added by zulipbot] label Mar 27, 2020
@neiljp neiljp added the PR needs review PR requires feedback to proceed label Mar 27, 2020
@neiljp neiljp force-pushed the 2020-03-terminal-color-depth branch from 238dc5f to c094a46 Compare March 27, 2020 06:32
@neiljp neiljp force-pushed the 2020-03-terminal-color-depth branch 2 times, most recently from e4f6057 to 99c6519 Compare April 1, 2020 03:31
@neiljp neiljp mentioned this pull request Apr 2, 2020
Copy link
Member

@preetmishra preetmishra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neiljp Thanks, this will extend Zulip Terminal's color depth support and make it easier to add 24-bit support later down the road. 👍

This seems to work well and close to being merged. However, this doesn't add support for configuring color-depth via zuliprc. We may choose to address this later.

@@ -136,7 +136,8 @@ def __init__(self, properties: List[Any],
inverse_text = background if background else 'black'
break
view.palette.append((
self.color, '', '', '', self.color+', bold', background))
self.color, 'dark blue, bold', 'black', '',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this makes streams standout in dark themes, it doesn't add much (aesthetically) to the light themes (light and blue). We might want to drop (as you mention in the PR) and address this in a follow-up PR later.

zulipterminal/config/themes.py Outdated Show resolved Hide resolved
('bold', 'white, bold', '', 'bold'),
('footer', 'white', 'dark red', 'standout'),
('starred', 'light red, bold', '', 'bold'),
('category', 'light blue, bold', '', 'standout'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that theme_with_monochrome_added is introduced in the next commit, which essentially does similar amendments, are these changes required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had these present to prototype what an improved monochrome theme might look like, without adding it to every theme - then realized that actually we would have to add it everywhere.

I've essentially skipped this commit in the next push, and instead removed the mono styles for each theme.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that having this in here isn't an issue - it's easy enough to drop an individual commit before merging :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the prospect now; thanks for the explanation. :)

@neiljp neiljp force-pushed the 2020-03-terminal-color-depth branch from 99c6519 to b03048d Compare April 17, 2020 04:59
Copy link
Member

@preetmishra preetmishra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neiljp Thanks for the improvements. The changes and commits look good to me. 👍

zulipterminal/config/themes.py Show resolved Hide resolved
Monochrome styles in each theme were limited at best and out of date;
this commit removes them in favor of a default theme when in monochrome
mode.

The required_styles set is extended into a dict, now including the
values of monochrome settings for each style. The new
theme_with_monochrome function amends each style in a theme to use these
values, overwriting them if they already exist in a theme.

Tests added for theme_with_monochrome_added.
@neiljp neiljp force-pushed the 2020-03-terminal-color-depth branch from b03048d to e48d67e Compare April 17, 2020 17:15
Copy link
Member

@preetmishra preetmishra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neiljp Thanks! This is ready to be merged. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR needs review PR requires feedback to proceed size: XL [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants