Skip to content

Instantly share code, notes, and snippets.

@nhall
Last active June 7, 2019 17:38
Show Gist options
  • Save nhall/7e2979d04ad20238b493852a4b8d7c9c to your computer and use it in GitHub Desktop.
Save nhall/7e2979d04ad20238b493852a4b8d7c9c to your computer and use it in GitHub Desktop.
Automating contrast accessibility
@mixin accessible-color($color: #000) {
$red: red($color);
$green: green($color);
$blue: blue($color);
color: rgb(
(((($red * 299) + ($blue * 114) + ($green * 587)) - 128000) * -1000),
(((($red * 299) + ($blue * 114) + ($green * 587)) - 128000) * -1000),
(((($red * 299) + ($blue * 114) + ($green * 587)) - 128000) * -1000)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment