-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #374 from alphagov/sass-warn
Add colour contrast test
- Loading branch information
Showing
4 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
node_modules/ | ||
.sass-cache | ||
npm-debug.log | ||
spec/stylesheets | ||
spec/stylesheets/test* | ||
_SpecRunner.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@import "colours/organisation"; | ||
@import "sass-color-helpers/stylesheets/color-helpers/math"; | ||
@import "sass-color-helpers/stylesheets/color-helpers/contrast"; | ||
|
||
@each $organisation in $all-organisation-brand-colours { | ||
$minimum-contrast: 4.5; | ||
$contrast: ch-color-contrast($white, nth($organisation, 3)); | ||
|
||
@if ($contrast < $minimum-contrast) { | ||
@error "Contrast ratio for #{nth($organisation, 1)} too low. #{nth($organisation, 3)} on #{$white} has a contrast of: #{$contrast}. Must be higher than #{$minimum-contrast} for WCAG AA support"; | ||
} | ||
} |