FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

Fix Color Contrast for Catppuccin Mocha card background

Open artkapl opened this issue 11 months ago • 6 comments

Fix Color Contrast for Catppuccin Mocha card background

Pull Request Type

  • [x] Bugfix
  • [ ] Feature Implementation
  • [ ] Documentation
  • [ ] Other

Related issue

closes #6597

Description

I wanted to improve the color contrast for the background around the video uploader's name on an uploader's comment. Strong color contrasts are important for accessibility.

This PR improves the color contrast from 1.07:1 to 3.59:1 (link to contrast checker) while still staying within the Catppuccin Mocha color palette ("Overlay 0").

I considered this color a decent middleground between background contrast and text contrast. The text vs. secondary-card-bg contrast is still a clearly differentiated 3.37:1.

Screenshots

Before: old

After: new

Testing

  • This was tested by changing the CSS code on a local FreeTube instance
  • No ramifications (other themes remain unchanged)

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: v0.23.1 Beta

Additional context

This satisfies the WCAG recommendation of at least 3:1.

artkapl avatar Feb 23 '25 09:02 artkapl

Thanks for looking into this!

I considered this color a decent middleground between background contrast and text contrast. The text vs. secondary-card-bg contrast is still a clearly differentiated 3.37:1.

Unfortunately, this will not suffice because the minimum acceptable color contrast between a text color and its background color is 4.5:1 or 7:1 (depending on whether WCAG AA or AAA standard is being used).

kommunarr avatar Feb 23 '25 14:02 kommunarr

Unfortunately, this will not suffice because the minimum acceptable color contrast between a text color and its background color is 4.5:1 or 7:1 (depending on whether WCAG AA or AAA standard is being used).

I hear you. However, there is a tradeoff between background contrast and text contrast. If we were to use blue (the Catppuccin recommendation for tags & pills), the card:background contrast is 8.33:1, but the text:card contrast is only 1.45:1.

If we choose a lighter color, the text is less readable. A darker color means the current implementation's problem.

If you have an idea as to which color offers a good contrast both versus the background and the text, I'm open to suggestions. Otherwise I don't see how to get one contrast without sacrificing the other.

Examples:

color hex card:bg card:text example
Overlay 0 #6c7086 3.59:1 3.37:1 overlay0
blue #89b4fa 8.33:1 1.45:1 blue
Overlay 1 #7f849c 4.75:1 2.55:1 overlay1
Surface 0 #313244 1.39:1 8.69:1 surface0

artkapl avatar Feb 23 '25 16:02 artkapl

That's unfortunately the case, and we should not sacrifice either if we can help it. One way we could do this is by having separate colors for the border around the name and the inner background text color.

kommunarr avatar Feb 23 '25 16:02 kommunarr

I'm not quite sure what you mean. Do you mean a border color for the background around the name? E.g. border

artkapl avatar Feb 26 '25 19:02 artkapl

Yep, exactly that.

kommunarr avatar Feb 26 '25 20:02 kommunarr

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Mar 13 '25 02:03 github-actions[bot]

This PR was closed because it has been stalled for 14 days with no activity.

github-actions[bot] avatar Mar 27 '25 02:03 github-actions[bot]