diff --git a/.changeset/nasty-turtles-judge.md b/.changeset/nasty-turtles-judge.md new file mode 100644 index 0000000000..a3438c04bb --- /dev/null +++ b/.changeset/nasty-turtles-judge.md @@ -0,0 +1,5 @@ +--- +'@swisspost/design-system-styles': patch +--- + +Changed color of text on the success background (#2c911c) to white from black for better contrast according to WCAG 3.0 diff --git a/packages/styles/src/functions/_contrast.scss b/packages/styles/src/functions/_contrast.scss index 762b847fa3..a5c35b1ad6 100644 --- a/packages/styles/src/functions/_contrast.scss +++ b/packages/styles/src/functions/_contrast.scss @@ -48,6 +48,15 @@ } @function light-or-dark($background, $light-color: #fff, $dark-color: #000) { + /* + exception for Success-color issue #2227 + the color is statically defined because the reference to the variable from here + would create a loop + */ + @if ($background == #2c911c) { + @return 'dark'; + } + // Contrast ratio with a light color $contrast-light: contrast-ratio($background, $light-color); diff --git a/packages/styles/src/variables/_color.scss b/packages/styles/src/variables/_color.scss index ac2d251501..aeade15ddd 100644 --- a/packages/styles/src/variables/_color.scss +++ b/packages/styles/src/variables/_color.scss @@ -47,7 +47,7 @@ $warning: #f49e00; $info: #cce4ee; // Signal Colors -$success-green: #2c871d; +$success-green: #2c871d; /* When value is changed, please changed as well the copied value in ../functions/_contrast.scss, @function light-or-dark()*/ $error-red: #a51728; $warning-orange: #f49e00; $success-background: #c0debb;