Skip to content

Commit 5a88d18

Browse files
committed
Use inverse-text colour in Notification Banner
Move the definition of the background next to the text colour adjustment to reduce risk of contrast issues. Because of how spacing is applied, this meant moving the code to the `__header` element rather than the `__title`. To coordinate colours between the border and the title background, introduce a local `--govuk-notification-banner-colour`, which also allows to reduce the amount of CSS neeed to swap to a `success` notification banner.
1 parent 0908ec4 commit 5a88d18

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

  • packages/govuk-frontend/src/govuk/components/notification-banner

packages/govuk-frontend/src/govuk/components/notification-banner/_mixin.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
/// @access private
66
@mixin styles {
77
.govuk-notification-banner {
8+
--govuk-notification-banner-colour: #{base.govuk-functional-colour(brand)};
9+
810
@include base.govuk-font($size: 19);
911
@include base.govuk-responsive-margin(8, "bottom");
1012

1113
border: base.$govuk-border-width solid;
12-
border-color: base.govuk-functional-colour(brand);
13-
14-
background-color: base.govuk-functional-colour(brand);
14+
border-color: var(--govuk-notification-banner-colour);
1515

1616
&:focus {
1717
outline: base.$govuk-focus-width solid;
@@ -26,6 +26,10 @@
2626
// text in high contrast mode
2727
border-bottom: 1px solid transparent;
2828

29+
--govuk-text-colour: #{base.govuk-functional-colour(inverse-text)};
30+
color: base.govuk-functional-colour(text);
31+
background-color: var(--govuk-notification-banner-colour);
32+
2933
@media #{base.govuk-from-breakpoint(tablet)} {
3034
padding: 2px base.govuk-spacing(4) base.govuk-spacing(1);
3135
}
@@ -38,7 +42,6 @@
3842
@include base.govuk-typography-weight-bold;
3943
margin: 0;
4044
padding: 0;
41-
color: base.govuk-colour("white");
4245
}
4346

4447
.govuk-notification-banner__content {
@@ -87,9 +90,7 @@
8790
}
8891

8992
.govuk-notification-banner--success {
90-
border-color: base.govuk-functional-colour(success);
91-
92-
background-color: base.govuk-functional-colour(success);
93+
--govuk-notification-banner-colour: #{base.govuk-functional-colour(success)};
9394

9495
.govuk-notification-banner__link {
9596
@include base.govuk-link-style-success;

0 commit comments

Comments
 (0)