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

Increase contrast in colors used in "My account" #5257

Merged
merged 4 commits into from
Oct 10, 2023
Merged

Conversation

javierm
Copy link
Member

@javierm javierm commented Sep 29, 2023

References

Objectives

  • Make links and buttons to delete content easier to read
  • Make initial avatars easier to read
  • Make it possible to read the institution name when the logo doesn't load

Visual Changes

Before these changes

The red color used in the "Erase my account" link doesn't contrast well against the background

The text and background colors in avatars don't contrast

After these changes

The red color used in the "Erase my account" link contrasts well against the background

The text and background colors in avatars contrast well

The color we were using didn't have enough contrast against a white
background, which made it harder to read texts like "Remove map marker"
or "Erase my account".

Since the new color is almost identical to the color we were using on
hover and for the border, we're changing the color on hover as well,
while IMHO it's no longer necessary to use a different color for the
border.
This way it'll be easier to change it.
Not all the colors initialjs uses by default provide enough contrast
against a white text. The default initialjs colors are:

["#1abc9c", "#16a085", "#f1c40f", "#f39c12", "#2ecc71", "#27ae60",
"#e67e22", "#d35400", "#3498db", "#2980b9", "#e74c3c", "#c0392b",
"#9b59b6", "#8e44ad", "#bdc3c7", "#34495e", "#2c3e50", "#95a5a6",
"#7f8c8d", "#ec87bf", "#d870ad", "#f69785", "#9ba37e", "#b49255",
"#b49255", "#a94136"]

We're replacing them with colors containing less luminosity when
necessary in order to get a 4,5:1 contrast (it could be argued that a
3:1 contrast is enough when the icons are big, but that isn't always the
case and more contrast doesn't hurt):

["#16836d", "#12826c", "#896f06", "#a06608", "#1e8549", "#1e8549",
"#b35e14", "#c75000", "#207ab6", "#2779b0", "#de2f1b", "#c0392b",
"#9b59b6", "#8e44ad", "#6c767f", "#34495e", "#2c3e50", "#66797a",
"#697677", "#d82286", "#c93b8e", "#db310f", "#727755", "#8a6f3d",
"#8a6f3d", "#a94136"]

Since initialjs doesn't provide a way to change these colors using
JavaScript, we're changing them in Ruby, following the same algorithm
used by initialjs.
We were displaying the alt text using the same color as the background
color, which made it impossible to read it when the logo didn't load
(for whatever reason).

Using the same color as the text, like done in the admin section, solves
the issue.
Consul Democracy automation moved this from Reviewing to Testing Oct 10, 2023
Base automatically changed from focus_contrast to master October 10, 2023 13:31
@javierm javierm merged commit 5317f2f into master Oct 10, 2023
13 checks passed
Consul Democracy automation moved this from Testing to Release 2.1.0 Oct 10, 2023
@javierm javierm deleted the increase_contrast branch October 10, 2023 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants