diff --git a/.storybook/storybook.scss b/.storybook/storybook.scss
index ab4bcb38..0495a3c6 100644
--- a/.storybook/storybook.scss
+++ b/.storybook/storybook.scss
@@ -1,5 +1,8 @@
+@use "sass:math";
+
@use "../src/nationalarchives/tools/colour";
@use "../src/nationalarchives/tools/media";
+@use "../src/nationalarchives/tools/typography";
@import "https://use.typekit.net/hkj3kuz.css";
@@ -164,3 +167,85 @@
@include colour.colour-background("background-tint");
}
}
+
+.tna-colour-contrast-demo {
+ width: 0;
+ max-width: calc(100% - 1px);
+ display: table;
+ table-layout: auto;
+
+ border-top: rgb(0 0 0/0.25) 1px solid;
+ border-left: rgb(0 0 0/0.25) 1px solid;
+
+ &__header {
+ display: table-header-group;
+ }
+
+ &__block {
+ width: #{math.div(100%, 6)};
+ padding: 1rem;
+
+ display: table-cell;
+
+ @include typography.main-font-weight-bold;
+
+ border-right: rgb(0 0 0/0.25) 1px solid;
+ border-bottom: rgb(0 0 0/0.25) 1px solid;
+ }
+
+ &__examples {
+ display: table-row-group;
+ }
+
+ &__theme-accent {
+ display: table-row;
+ }
+
+ &__example {
+ display: table-cell;
+
+ border-right: rgb(0 0 0/0.25) 1px solid;
+ border-bottom: rgb(0 0 0/0.25) 1px solid;
+
+ &:first-child {
+ min-width: 7rem;
+ padding: 1rem;
+
+ @include typography.relative-font-size(14);
+ }
+
+ &-content {
+ height: 100%;
+ padding: 1rem;
+ }
+ }
+
+ &__link {
+ &--visited {
+ @include colour.colour-font("link-visited", true);
+ }
+ }
+
+ .tna-template {
+ min-width: 15.25rem;
+
+ p:not(:first-child) {
+ margin-top: 0.25rem;
+ }
+ }
+
+ .tna-chip {
+ margin: 1rem 0;
+ }
+
+ .tna-button-group {
+ margin-top: 1rem;
+
+ gap: 0.5rem;
+ flex-wrap: nowrap;
+ }
+
+ .tna-pagination {
+ margin-top: 1rem;
+ }
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f1f96cc..6ebb5a9c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,16 +18,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Card meta information changed to chip list
- Improvements to high contrast modes
+- Link colours changed for better contrast
- Index grid heading options have been flattened to match other components
### Deprecated
### Removed
- Removed generic `accent` CSS variable
+- The black theme accent has been removed
### Fixed
- Multiple line spacing for chip lists fixed
+- Accented chips can now be used on accented backgrounds
- Index grid can now be used on a contrast background
### Security
diff --git a/src/nationalarchives/components/button/button.scss b/src/nationalarchives/components/button/button.scss
index 65b03391..96f2b02a 100644
--- a/src/nationalarchives/components/button/button.scss
+++ b/src/nationalarchives/components/button/button.scss
@@ -148,14 +148,20 @@
}
}
- &--solid-hover,
- .tna-background-accent-light &,
- .tna-background-accent &:not(.tna-button--accent) {
+ &--solid-hover {
&:not(.tna-button--plain):hover {
+ @include colour.colour-font("font-dark");
+
@include colour.colour-background("page-background");
}
}
+ .tna-background-accent & {
+ &:hover {
+ @include colour.colour-font("font-dark");
+ }
+ }
+
.tna-background-accent &--accent {
@include colour.plain;
diff --git a/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js b/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js
index b898354e..899c2bfb 100644
--- a/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js
+++ b/src/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js
@@ -33,7 +33,7 @@ const argTypes = {
},
accent: {
control: "radio",
- options: ["none", "black", "yellow", "pink", "orange", "green", "blue"],
+ options: ["none", "yellow", "pink", "orange", "green", "blue"],
},
};
@@ -78,19 +78,17 @@ const Template = ({ theme, accent }) => {
? "tna-template--dark-theme tna-template--high-contrast-theme"
: ""
} ${
- accent === "black"
- ? "tna-template--black-accent"
- : accent === "yellow"
- ? "tna-template--yellow-accent"
- : accent === "pink"
- ? "tna-template--pink-accent"
- : accent === "orange"
- ? "tna-template--orange-accent"
- : accent === "green"
- ? "tna-template--green-accent"
- : accent === "blue"
- ? "tna-template--blue-accent"
- : ""
+ accent === "yellow"
+ ? "tna-template--yellow-accent"
+ : accent === "pink"
+ ? "tna-template--pink-accent"
+ : accent === "orange"
+ ? "tna-template--orange-accent"
+ : accent === "green"
+ ? "tna-template--green-accent"
+ : accent === "blue"
+ ? "tna-template--blue-accent"
+ : ""
}">
+
+
+
+
+ `,
+ "",
+ )}
+ `,
+ "",
+ )}`,
+ "",
+ )}
+
+`;
+};
+
+export const Combinations = CombinationsTemplate.bind({});
+Combinations.args = {};
diff --git a/src/nationalarchives/tools/_colour.scss b/src/nationalarchives/tools/_colour.scss
index a8d76d26..fe7866ff 100644
--- a/src/nationalarchives/tools/_colour.scss
+++ b/src/nationalarchives/tools/_colour.scss
@@ -52,25 +52,23 @@
--accent-link-visited: #{brand-colour("white")} !important;
--accent-keyline: #{brand-colour("white", 0.5)} !important;
--accent-keyline-dark: #{brand-colour("white", 0.8)} !important;
- @if $colour != "black" {
- --button-accent-text: #{brand-colour("white")} !important;
- @if $colour == "pink" {
- --accent-background: #{brand-colour("maroon")} !important;
- --accent-background-light: #{brand-colour("pastel-pink")} !important;
- --button-accent-background: #{brand-colour("maroon")} !important;
- } @else if $colour == "orange" {
- --accent-background: #{brand-colour("chestnut")} !important;
- --accent-background-light: #{brand-colour("pastel-orange")} !important;
- --button-accent-background: #{brand-colour("chestnut")} !important;
- } @else if $colour == "green" {
- --accent-background: #{brand-colour("forest")} !important;
- --accent-background-light: #{brand-colour("pastel-green")} !important;
- --button-accent-background: #{brand-colour("forest")} !important;
- } @else if $colour == "blue" {
- --accent-background: #{brand-colour("navy")} !important;
- --accent-background-light: #{brand-colour("pastel-blue")} !important;
- --button-accent-background: #{brand-colour("navy")} !important;
- }
+ --button-accent-text: #{brand-colour("white")} !important;
+ @if $colour == "pink" {
+ --accent-background: #{brand-colour("maroon")} !important;
+ --accent-background-light: #{brand-colour("pastel-pink")} !important;
+ --button-accent-background: #{brand-colour("maroon")} !important;
+ } @else if $colour == "orange" {
+ --accent-background: #{brand-colour("chestnut")} !important;
+ --accent-background-light: #{brand-colour("pastel-orange")} !important;
+ --button-accent-background: #{brand-colour("chestnut")} !important;
+ } @else if $colour == "green" {
+ --accent-background: #{brand-colour("forest")} !important;
+ --accent-background-light: #{brand-colour("pastel-green")} !important;
+ --button-accent-background: #{brand-colour("forest")} !important;
+ } @else if $colour == "blue" {
+ --accent-background: #{brand-colour("navy")} !important;
+ --accent-background-light: #{brand-colour("pastel-blue")} !important;
+ --button-accent-background: #{brand-colour("navy")} !important;
}
}
}
@@ -249,7 +247,7 @@
--font-light: var(--accent-font-light);
--icon-light: var(--accent-icon-light);
--link: var(--accent-link);
- --link-visited: var(--accent-link-visited);
+ --link-visited: var(--accent-link);
--keyline: var(--accent-keyline);
--keyline-dark: var(--accent-keyline-dark);
@@ -284,8 +282,8 @@
--font-base: #{map.get(colour.$colour-palette-default, "font-base")};
--font-dark: #{map.get(colour.$colour-palette-default, "font-dark")};
--font-light: #{map.get(colour.$colour-palette-default, "font-light")};
- --link: #{map.get(colour.$colour-palette-default, "font-dark")};
- --link-visited: #{map.get(colour.$colour-palette-default, "link-visited")};
+ // --link: #{map.get(colour.$colour-palette-default, "link")};
+ // --link-visited: #{map.get(colour.$colour-palette-default, "link-visited")};
--keyline: #{map.get(colour.$colour-palette-default, "keyline")};
--keyline-dark: #{map.get(colour.$colour-palette-default, "keyline-dark")};
--button-text: #{map.get(colour.$colour-palette-default, "button-text")};
@@ -304,6 +302,18 @@
@include colour-background("background");
@include colour-font("font-base");
+
+ .tna-template--system-theme & {
+ @media (prefers-color-scheme: dark) {
+ --link: #{map.get(colour.$colour-palette-default, "link")};
+ --link-visited: #{map.get(colour.$colour-palette-default, "link-visited")};
+ }
+ }
+
+ .tna-template--dark-theme & {
+ --link: #{map.get(colour.$colour-palette-default, "link")};
+ --link-visited: #{map.get(colour.$colour-palette-default, "link-visited")};
+ }
}
@mixin accent-light {
diff --git a/src/nationalarchives/utilities/_colour.scss b/src/nationalarchives/utilities/_colour.scss
index d2bde637..7c6a4e87 100644
--- a/src/nationalarchives/utilities/_colour.scss
+++ b/src/nationalarchives/utilities/_colour.scss
@@ -47,10 +47,6 @@
}
}
- &--black-accent {
- @include colour.accent-css-vars("black");
- }
-
&--yellow-accent {
@include colour.accent-css-vars("yellow");
}
diff --git a/src/nationalarchives/utilities/_typography.scss b/src/nationalarchives/utilities/_typography.scss
index 300b0802..b8ca520e 100644
--- a/src/nationalarchives/utilities/_typography.scss
+++ b/src/nationalarchives/utilities/_typography.scss
@@ -143,6 +143,12 @@ small {
@include colour.accent;
@include colour.colour-border("accent-background", 0.125rem);
+
+ .tna-background-accent &:not(#{&}--plain) {
+ @include colour.plain;
+
+ @include colour.colour-border("background");
+ }
}
.tna-chip {
diff --git a/src/nationalarchives/variables/_colour.scss b/src/nationalarchives/variables/_colour.scss
index 86519867..fbd97285 100644
--- a/src/nationalarchives/variables/_colour.scss
+++ b/src/nationalarchives/variables/_colour.scss
@@ -39,7 +39,7 @@ $colour-palette-brand: (
$dark-grey: #26262a;
$base-font: #343338 !default;
-$link-colour: brand-colour("navy") !default;
+$link-colour: #0062a8 !default;
$link-colour-visited: #4c2c92 !default;
/*
@@ -49,7 +49,7 @@ LIGHT THEME (DEFAULT)
*/
$colour-palette-default: (
"page-background": #f4f4f4,
- "background-tint": #e2e2e2,
+ "background-tint": #ededed,
"font-base": $base-font,
"font-dark": brand-colour("black"),
"font-light": hex-to-rgb($base-font, 0.7),
@@ -81,7 +81,7 @@ $colour-palette-default: (
"contrast-button-hover-text": brand-colour("white"),
"contrast-button-hover-background": brand-colour("black"),
"accent-background": #111,
- "accent-background-light": brand-colour("light-grey"),
+ "accent-background-light": #ededed,
"accent-font-base": brand-colour("white"),
"accent-font-dark": brand-colour("white"),
"accent-font-light": brand-colour("white", 0.7),
@@ -123,8 +123,7 @@ $colour-palette-dark: map.merge(
"contrast-background": #111,
"contrast-link-visited":
map.get($colour-palette-default, "contrast-link-visited"),
- // --accent-background-light is the same as --contrast-background on dark themes
- "accent-background-light": brand-colour("grey"),
+ // "accent-background-light": brand-colour("light-grey"),
)
) !default;
@@ -149,8 +148,8 @@ $colour-palette-high-contrast: map.merge(
"contrast-font-base": brand-colour("black"),
"contrast-font-dark": brand-colour("black"),
"contrast-font-light": brand-colour("black"),
- "contrast-link": brand-colour("navy"),
- "contrast-link-visited": brand-colour("black"),
+ "contrast-link": #34d,
+ "contrast-link-visited": #848,
"contrast-keyline": brand-colour("black"),
"contrast-keyline-dark": brand-colour("black"),
"contrast-button-text": brand-colour("white"),
@@ -173,7 +172,7 @@ $colour-palette-high-contrast-dark: map.merge(
"font-light": brand-colour("white"),
"icon-light": brand-colour("white", 0.75),
"link": #69f,
- "link-visited": #a6c,
+ "link-visited": #b9f,
"keyline": brand-colour("white"),
"contrast-background": brand-colour("black"),
)