Git Product home page Git Product logo

automated-a11y-sass's Introduction

automated-a11y-sass

Sass functions that support accessible color contrast ratios

Requirements

Minimum Sass version 3.4.25. Libsass 3.5.4 (best performance).

Sandboxes

Editable sandbox on CodePen to see how this all works. Change the color variables to see the updates in real-time within the size tests.

When an edge case has been encountered, a version in SassMeister with debug output is helpful to see what might be happening (I changed the main function to a mixin so I can debug the output):

sassmeister.com/gist/42b8402a3cb5ac41f8557df4e175b1f7

Article with Full Explanation

Programming Sass to Create Accessible Color Combinations

Acknowledgments

  • Previous ideas used lots of math to replicate a pow() function but it was not performant. Then I used a lookup table and that worked pretty well. Better still, Merovex provided a succinct and performant pow() from Hail2u
  • Luminance function adapted from Sérgio Gomes who borrowed code from voxpelli
  • “Light or Dark?” function also adapted from Sérgio Gomes
  • Contrast ratio calculation adapted from Lea Verou’s Color.js
  • Debugging the @while Sass statement help from Merovex
  • And finally, lots of other various sources of math and approaches to this until I came across the best way to do things (so far)

automated-a11y-sass's People

Contributors

jhogue avatar

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.