rename foreground and background to light and dark (#32070)

This commit is contained in:
Jonah Williams 2019-05-06 08:02:08 -07:00 committed by GitHub
parent 99e7b0a0ff
commit dd5d0d6c36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -277,13 +277,14 @@ class MinimumTextContrastGuideline extends AccessibilityGuideline {
} else { } else {
targetContrastRatio = kMinimumRatioNormalText; targetContrastRatio = kMinimumRatioNormalText;
} }
if (contrastRatio - targetContrastRatio >= delta) if (contrastRatio - targetContrastRatio >= delta) {
return result + const Evaluation.pass(); return result + const Evaluation.pass();
}
return result + Evaluation.fail( return result + Evaluation.fail(
'$node:\nExpected contrast ratio of at least ' '$node:\nExpected contrast ratio of at least '
'$targetContrastRatio but found ${contrastRatio.toStringAsFixed(2)} for a font size of $fontSize. ' '$targetContrastRatio but found ${contrastRatio.toStringAsFixed(2)} for a font size of $fontSize. '
'The computed foreground color was: ${report.lightColor}, ' 'The computed light color was: ${report.lightColor}, '
'The computed background color was: ${report.darkColor}\n' 'The computed dark color was: ${report.darkColor}\n'
'See also: https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html' 'See also: https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html'
); );
} }

View File

@ -126,7 +126,7 @@ void main() {
'SemanticsNode#21(Rect.fromLTRB(300.0, 200.0, 500.0, 400.0), label: "this is a test",' 'SemanticsNode#21(Rect.fromLTRB(300.0, 200.0, 500.0, 400.0), label: "this is a test",'
' textDirection: ltr):\nExpected contrast ratio of at least ' ' textDirection: ltr):\nExpected contrast ratio of at least '
'4.5 but found 1.17 for a font size of 14.0. The ' '4.5 but found 1.17 for a font size of 14.0. The '
'computed foreground color was: Color(0xfffafafa), The computed background color was:' 'computed light color was: Color(0xfffafafa), The computed dark color was:'
' Color(0xffffeb3b)\n' ' Color(0xffffeb3b)\n'
'See also: https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html'); 'See also: https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html');
handle.dispose(); handle.dispose();