Code Monkey home page Code Monkey logo

Comments (8)

darekkay avatar darekkay commented on June 8, 2024 1

Hi @frankstallone , I cannot reproduce this issue. Can you please post the whole palette file? I would assume that it's either the $primary vs primary difference or the fact that the tool doesn't support 100 steps (#1). But I didn't get any issue with the 3 colors you've posted.

I only get the issue when one of the colors is invalid (like "foo"). I should at least improve the error message here, so the affected color value is being displayed.

from a11y-contrast.

darekkay avatar darekkay commented on June 8, 2024 1

While the 100 steps definitely won't work (as in: the tool will not be able to compute the values), I don't think this is the reason for your error message. This message can only happen if a color value is in fact not valid. RGB, HSV, HSL, and CMYK are supported, so there must be some error somewhere in your palette.

For example, this one doesn't throw any error:

{
  "gray": {
    "$gray-100": "hsl(186, 100%, 94%)",
    "$gray-200": "hsl(186, 100%, 94%)",
    "$gray-300": "hsl(186, 100%, 94%)",
    "$gray-400": "hsl(186, 100%, 94%)",
    "$gray-500": "hsl(186, 100%, 94%)",
    "$gray-600": "hsl(186, 100%, 94%)",
    "$gray-700": "hsl(186, 100%, 94%)",
    "$gray-800": "hsl(186, 100%, 94%)",
    "$gray-900": "hsl(186, 100%, 94%)"
  },
  "red": {
    "$red-100": "hsl(186, 100%, 94%)",
    "$red-200": "hsl(186, 100%, 94%)",
    "$red-300": "hsl(186, 100%, 94%)",
    "$red-400": "hsl(186, 100%, 94%)",
    "$red-500": "hsl(186, 100%, 94%)",
    "$red-600": "hsl(186, 100%, 94%)",
    "$red-700": "hsl(186, 100%, 94%)",
    "$red-800": "hsl(186, 100%, 94%)",
    "$red-900": "hsl(186, 100%, 94%)"
  }
}

I will improve the tool to output all invalid colors.

from a11y-contrast.

darekkay avatar darekkay commented on June 8, 2024 1

had a space at the end of the string

Thanks for this hint, I will also trim the color values to prevent such issues in the future.

Is this the expected results because I don't have the correct steps? If so, can I just knock a 0 off mine or do I need to conform to some grade/step standard?

Yes, that's the reason. And yes, you can just remove a 0 from every color, and it should work. Even your 110 and 120 values should work fine in theory. And your results confirm this. What you get are the magic numbers 70, 80 and 90. Because those values are so high for your color palette, they might be not that useful for a generic use. If you're targetting WCAG AA (contrast ratio >= 4.5), every difference of 80(0)+ will be accessible (e.g. gray-100 and gray-900 or gray-200 and gray-1000).

In summary, it doesn't matter whether you're using gray-1, gray-10 or gray-100 for defining your color palette grades (apart from my tool only handling gray-10 at this moment). But because your highest value isn't the absolute maximum (you've extended the palette with even higher values), it will lead to rather high magic numbers. The same problem exists for the Open Color palette.

It also doesn't mean that your color palette is "bad" or "inaccessible" - it just means that the magic number approach doesn't work as well as it does for other palettes.

from a11y-contrast.

darekkay avatar darekkay commented on June 8, 2024 1

You helped me understand the elements that did not click for me from reading your article.

Yes, it's a rather complex topic and it was difficult for me to explain it. I would be happy to improve my blog post if you could point out the places which you've found confusing.

I want something that can look at all the colors in our palette (82) and put together recommendation pairings for each color combination

You mean you would like to pass a color palette and get all valid color combinations for a given contrast ratio? I think colorable should be able to solve this issue. While a11y-contrast focuses on the magic numbers principle, I think it would be a great addition to have your described behavior built-in. I've created #3 for this.

from a11y-contrast.

frankstallone avatar frankstallone commented on June 8, 2024

Okay so I added my EDIT while you replied. I saw your post come up as I was submitting. Yeah this palette was made before reading there was a specific step requirement. I think this is related to your other post. I removed the $'s -- that was left over from converting from SASS.

from a11y-contrast.

frankstallone avatar frankstallone commented on June 8, 2024

Hah, primary-500 had a space at the end of the string. That was the issue.

Is this the expected results because I don't have the correct steps? If so, can I just knock a 0 off mine or do I need to conform to some grade/step standard?

Screen Shot 2020-11-12 at 11 14 38 AM

EDIT: If I take out 0's from all I get:

Screen Shot 2020-11-12 at 11 25 50 AM

from a11y-contrast.

frankstallone avatar frankstallone commented on June 8, 2024

Very interesting, and thank you for elaborating on this. You helped me understand the elements that did not click for me from reading your article. Ultimately, this tool was the best I could find so far, or closest to what I am looking for.

I want something that can look at all the colors in our palette (82) and put together recommendation pairings for each color combination and it's lighter version for text, in alignment with WCAG recommendations. I might find a better way to phrase that, but I think I had in the past seen a tool that does this. Then I can put a demo together in our design system which is created in a Storybook. If you know of such a tool let me know. Thanks again for creating this one!

from a11y-contrast.

frankstallone avatar frankstallone commented on June 8, 2024

I would be happy to improve my blog post if you could point out the places which you've found confusing.

If I can come up with a clearer way of articulating what you've done here I'll let you know. However, I feel as though the topic is just heavy. There is a lot to know, and a lot to consider.

You mean you would like to pass a color palette and get all valid color combinations for a given contrast ratio?

Yes, exactly.

colorable looks like it creates palettes, but I will give it a try. 82 colors is enough for right now, I don't need more hah! That's great if you think it would be a worthy addition to your project. leonardo has a feature that add bulk key colors but from my limited understanding that, too, seems to create color palettes from your keys, instead of comparing. I have learned a lot over the past few days and really do appreciate your time and patience.

from a11y-contrast.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.