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

Convert all colors in our CSS to HSL #3516

Closed
gnprice opened this issue Jun 6, 2019 · 2 comments
Closed

Convert all colors in our CSS to HSL #3516

gnprice opened this issue Jun 6, 2019 · 2 comments

Comments

@gnprice
Copy link
Member

gnprice commented Jun 6, 2019

(Expanded from #3491 (comment) .)

The webapp makes a practice of using HSL instead of RGB (there are a few exceptions, but I think those are where people just didn't know and it wasn't caught in review.)

There are good reasons for this, because it makes it easier to understand what the color is, and also to make changes to it. See here and here for some good explanations.

We aren't currently consistent about this ourselves -- in the CSS for the message list WebView, it's about half and half, ignoring colors that are just flat gray. Let's convert to all HSL.

Here's a search that I think finds all the colors expressed as RGB:

$ git grep -Phoi -e 'rgb.*?\)' -e '#[0-9a-f]+' src/webview/css/ | perl -pe 's/, ?/, /g' | sort

Or to get them in context / with line numbers:

$ rg -i -e 'rgb.*?\)' -e '#[0-9a-f]+' src/webview/css/

A way to go about this:

  • First, convert all the zero-saturation colors, where R == G == B. These will be pretty mechanical, I think, so one or a handful of commits can sweep through them. As the first command (the one with grep -o and sort) shows, these are a large fraction of the total.
  • Then, take one color at a time (or a few closely-related colors, like #008000 and #00a000), and convert it everywhere. Find an RGB->HSL converter on the web to compute the new values. Be sure to identify how you did the conversion (e.g. link to the converter), in the PR and at least the first commit message.
@gnprice
Copy link
Member Author

gnprice commented Jun 6, 2019

A good follow-up would be to do the same for colors in our RN code. The syntax is basically the same:
https://facebook.github.io/react-native/docs/colors

Let's do that as a separate series of commits, though -- the diffs will look a little different, so I think it'll be easier to read that way.

ishammahajan added a commit to ishammahajan/zulip-mobile that referenced this issue Jun 7, 2019
As discussed within zulip#3516, this commit changes all colors present in
the CSS file to match the HSL standard -- by using the extension
available in the market called 'Color Picker' which also allows for
conversion of color (type 'Convert Color' in the command palette).

Fixes zulip#3516.
ishammahajan added a commit to ishammahajan/zulip-mobile that referenced this issue Jun 7, 2019
Color scheme has been changed everywhere except on all tests for
selectors which find colors for different features of the app. This
is because the selectors fetch colors from the backend, and the
reason why this change is happening (described in related issue)
does not concern colors fetched from the backend.

Fixes zulip#3516.
@ishammahajan ishammahajan mentioned this issue Jun 7, 2019
@ishammahajan
Copy link
Collaborator

#3519 fixes this issue (commenting for notification).

ishammahajan added a commit to ishammahajan/zulip-mobile that referenced this issue Jun 17, 2019
As discussed within zulip#3516, this commit changes all colors present in
the CSS file to match the HSL standard -- by using the extension
available in the market called 'Color Picker' which also allows for
conversion of color (type 'Convert Color' in the command palette).
https://marketplace.visualstudio.com/items?itemName=anseki.vscode-color

Fixes zulip#3516.
ishammahajan added a commit to ishammahajan/zulip-mobile that referenced this issue Jun 17, 2019
Color scheme has been changed everywhere except on all tests for
selectors which find colors for different features of the app. This
is because the selectors fetch colors from the backend, and the
reason why this change is happening (described in related issue)
does not concern colors fetched from the backend.

Colors converted using vscode extension 'Color Picker'.
https://marketplace.visualstudio.com/items?itemName=anseki.vscode-color
Fixes zulip#3516.
gnprice pushed a commit to ishammahajan/zulip-mobile that referenced this issue Jun 19, 2019
Color format has been changed everywhere, except on all tests for
selectors which find colors for different features of the app. This
is because the selectors fetch colors from the backend, and the
reason why this change is happening (described in related issue)
does not concern colors fetched from the backend.

Colors converted using vscode extension 'Color Picker'.
https://marketplace.visualstudio.com/items?itemName=anseki.vscode-color

This is a followup to zulip#3516.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants