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

Feature: contrast theme changes #361

Merged
merged 4 commits into from
Mar 12, 2024

Conversation

lukengda
Copy link
Contributor

Hi, I worked on a theme that meets the contrast ratio as described in #357, i went over all text colors and their background colors they appear on to check the contrast ratios. I am not sure whether the changes fall into the "purely cosmetic" changes or not. I guess thats up to you to decide.

Though, i also encountered a small bug in theming caused by a typo.

Closes #357

Approach

The changes are done by inspecting the app using chromium-based dev tools. The dev-tools report the contrast ratios to their respective backgrounds. Every ratio – that i've found that was less then 4.5 – was updated using the automatic "next best" color that satisfies the ratio requirements for accessibility by clicking the button marked with the red arrow in the following screenshot:
Screenshot 2024-02-28 at 09 49 52

In some cases, i took the creative freedom to match some of the colors to match better in their hue based on hsl color theory. I tried to match the original style as well as possible. Let me know if i should revert some of the changes.

I was only able to meet the contrast requirements by separating accent-text colors for content and header through the introduction of a new header-accent-text color.

Before-and-after Comparison

current themes on the left, new proposal on the right.

Light theme

image-list-light-oldimage-list-light-new
search-text-light-oldsearch-text-light-new
tag-list-light-oldtag-list-light-new
history-light-oldhistory-light-new
dockerfile-light-olddockerfile-light-new

Dark theme

image-list-dark-oldimage-list-dark-new
search-text-dark-oldsearch-text-dark-new
tag-list-dark-oldtag-list-dark-new
history-dark-oldhistory-dark-new
dockerfile-dark-olddockerfile-dark-new

Lukas Engelter added 4 commits February 28, 2024 10:28
The ' ' space that is in the h2 in the template is swallowed up by the material icon. By adding a manual margin of the width of a normal space (1/4th character width).

Another solution would be to replace the space with a ` `, but this adds the non-breaking space to the selection of text when highlighting words in the browser, which i did not prefer.
This is done by inspecting the app using chromium-based dev tools. The dev-tools report the contrast ratios to their respective backgrounds. Every ratio – that i've found that was less then 4.5 – was updated using the automatic "next best" color that satisfies the ratio requirements for accessibility.

In some cases, i took the creative freedom to match some of the colors to match better in their hue based on hsl color theory. Please compare the screenshots in the associated PR. I tried to match the original style as well as possible.

I was only able to meet the contrast requirements by separating accent-text colors for content and header through the introduction of a new header-accent-text color.
A typo in the env var mapping caused that theme.js was not possible to override "footer-neutral-text".
@lukengda lukengda changed the title Feature/contrast theme changes Feature: contrast theme changes Feb 29, 2024
@silverwind
Copy link
Contributor

Looks great, thanks!

Copy link
Owner

@Joxit Joxit left a comment

Choose a reason for hiding this comment

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

Hi, thank you for using my project and for your contribution 🥰

@Joxit Joxit merged commit cfbc6e7 into Joxit:main Mar 12, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search bar "placeholder" has low contrast on dark mode
3 participants