|
11 | 11 | @result: if(@contrast-ratio-dark >= @contrast-ratio-light,
|
12 | 12 | @dark,
|
13 | 13 | @light
|
14 |
| - ) |
| 14 | + ); |
15 | 15 | }
|
16 | 16 |
|
17 | 17 | // Similar to .contrast, but it will strongly prefer the preferred colour
|
|
21 | 21 | // If they don't, you may get a result that doesn't pass AA.
|
22 | 22 | .contrast-fallback(@background, @preferred, @fallback) {
|
23 | 23 | @contrast-ratio-preferred: #wcag.contrast-ratio(@background, @preferred)[@result];
|
24 |
| - @contrast-ratio-fallback: #wcag.contrast-ratio(@background, @fallback)[@result]; |
25 | 24 |
|
26 | 25 | @result: if(@contrast-ratio-preferred >= #wcag[@aa-contrast],
|
27 | 26 | @preferred,
|
|
34 | 33 | // Contrast on steroids. This function may also modify the background colour
|
35 | 34 | // in order to make a colour pass the contrast threshold, and it heavily
|
36 | 35 | // favours the light colour over the dark colour because of situations such
|
37 |
| - // as navigation where |
| 36 | + // as navigation where the background colour is not known. |
38 | 37 | .ultra-contrast(@background, @light, @dark) {
|
39 | 38 | @target-contrast: #wcag[@aa-contrast];
|
40 | 39 |
|
41 |
| - @lighter-background: lighten(@background, 25%); |
42 |
| - @darker-background: darken(@background, 15%); |
| 40 | + @lighter-background: tint(@background, 40%); |
| 41 | + @darker-background: screen(@background, darken(white, 30%)); |
43 | 42 |
|
44 | 43 | @light-aa: boolean(#wcag.contrast-ratio(@background, @light)[@result] > @target-contrast);
|
45 | 44 | @dark-aa: boolean(#wcag.contrast-ratio(@background, @dark)[@result] > @target-contrast);
|
|
57 | 56 | {
|
58 | 57 | @msg: "Dark colour passes AA";
|
59 | 58 | @fg: @dark;
|
60 |
| - @bg: @background; |
| 59 | + // @background would pass AA here but we've decided to go lighter for that extra boost, |
| 60 | + // as AA black text just doesn't appear as contrasting in practice. |
| 61 | + @bg: @lighter-background; |
61 | 62 | },
|
62 | 63 | if(@enhanced-dark-aa,
|
63 | 64 | {
|
|
0 commit comments