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

Add WCAG colors extension #39

Closed
chrs1885 opened this issue Nov 14, 2018 · 0 comments
Closed

Add WCAG colors extension #39

chrs1885 opened this issue Nov 14, 2018 · 0 comments
Labels
feature Request a new feature
Milestone

Comments

@chrs1885
Copy link
Owner

chrs1885 commented Nov 14, 2018

What kind of feature would you like to see?

The Web Content Accessibility Guidelines (WCAG) define best practices for colors used on websites. These guidelines could easily be used to define a WCAG extension on UIColor.

How does it work in detail?

I'm not too sure about all requirements, yet, so I'm looking for some suggestions. Here is what I came up with initially.

Expose functions to get:

  • The contrast ratio for a pair of colors
  • A high contrast foreground color for a given background color (white, black, or the first match from a given list of colors)
  • A high contrast background color for a given background color (white, black, or the first match from a given list of colors)
  • A high contrast foreground color for a given background image (white, black, or the first match from a given list of colors)

The contrast requirements are based on the text size, background alpha, level of conformance, and font weight.

See https://webaim.org/articles/contrast/

What does the API look like?

We need to create a UIColor extension meeting the requirements above. The function names and params are up to the author. We also need to create a separate subspec and extend the existing example projects with a new screen to showcase this feature.

Any existing projects that do something similar?

I've seen one project that exposes an API to calculate the contrast ratio for a given color pair: https://github.com/soffes/Color

@chrs1885 chrs1885 added the feature Request a new feature label Nov 14, 2018
@chrs1885 chrs1885 added this to the 0.9.0 milestone Nov 14, 2018
@chrs1885 chrs1885 added question Further information is requested in progress We are currently working on it. and removed question Further information is requested labels Nov 14, 2018
@chrs1885 chrs1885 removed the in progress We are currently working on it. label Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request a new feature
Projects
None yet
Development

No branches or pull requests

1 participant