Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Light accent on dark theme #159

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Removed `:focus` styles and replaced with `:focus-visible`
- Light accent blocks appear normal accent colours in dark themes

### Deprecated
### Removed
Expand Down
51 changes: 43 additions & 8 deletions src/nationalarchives/components/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -173,29 +173,64 @@ $button-border-width: 4px !default;
}
}

.tna-background-accent & {
.tna-background-accent &,
.tna-template--dark-theme .tna-background-accent-light & {
&:hover {
@include colour.colour-font("font-dark");
}
}

.tna-background-accent &--accent {
@include colour.contrast;
.tna-background-accent &--accent,
.tna-template--dark-theme .tna-background-accent-light &--accent {
// @include colour.contrast;

@include colour.colour-background("button-background");
// @include colour.colour-background("button-background");
@include colour.colour-background("contrast-button-background");

@include colour.colour-border("button-background");
// @include colour.colour-border("button-background");
@include colour.colour-border("contrast-button-background");

&,
&:link,
&:visited {
@include colour.colour-font("button-text");
// @include colour.colour-font("button-text");
@include colour.colour-font("contrast-button-text");
}

&:hover {
@include colour.colour-font("font-dark");
// @include colour.colour-font("font-dark");
@include colour.colour-font("contrast-font-dark");

@include colour.colour-background("background");
// @include colour.colour-background("background");
@include colour.colour-background("contrast-background");
}
}

@media (prefers-color-scheme: dark) {
.tna-template--system-theme .tna-background-accent-light & {
&:hover {
@include colour.colour-font("font-dark");
}
}

.tna-template--system-theme .tna-background-accent-light &--accent {
// @include colour.contrast;

@include colour.colour-background("contrast-button-background");

@include colour.colour-border("contrast-button-background");

&,
&:link,
&:visited {
@include colour.colour-font("contrast-button-text");
}

&:hover {
@include colour.colour-font("contrast-font-dark");

@include colour.colour-background("contrast-background");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/nationalarchives/components/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
@include colour.colour-border("keyline-dark", 1px);
}

&:not(#{&}--horizontal) {
&:not(&--horizontal) {
@include colour.on-high-contrast-and-forced-colours {
.tna-card__inner {
padding-bottom: spacing.space(1);
Expand Down
42 changes: 37 additions & 5 deletions src/nationalarchives/tools/_colour.scss
Original file line number Diff line number Diff line change
Expand Up @@ -308,22 +308,54 @@
colour.$colour-palette-default,
"button-hover-background"
)};
--accent-border: var(--font-base);
--accent-list-marker: var(--font-base);
--accent-border: var(--accent-background);

@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")};
// --link: #{map.get(colour.$colour-palette-default, "link")};
// --link-visited: #{map.get(colour.$colour-palette-default, "link-visited")};

--background: var(--accent-background);
--font-base: var(--accent-font-base);
--font-dark: var(--accent-font-dark);
--font-light: var(--accent-font-light);
--icon-light: var(--accent-icon-light);
--link: var(--accent-link);
--link-visited: var(--accent-link);
--keyline: var(--accent-keyline);
--keyline-dark: var(--accent-keyline-dark);
--accent-list-marker: var(--accent-font-base);
--accent-border: var(--accent-font-dark);
--button-text: var(--accent-button-text);
--button-background: var(--accent-button-background);
--button-hover-text: var(--accent-button-hover-text);
--button-hover-background: var(--accent-button-hover-background);
}
}

.tna-template--dark-theme & {
--link: #{map.get(colour.$colour-palette-default, "link")};
--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")};

--background: var(--accent-background);
--font-base: var(--accent-font-base);
--font-dark: var(--accent-font-dark);
--font-light: var(--accent-font-light);
--icon-light: var(--accent-icon-light);
--link: var(--accent-link);
--link-visited: var(--accent-link);
--keyline: var(--accent-keyline);
--keyline-dark: var(--accent-keyline-dark);
--accent-list-marker: var(--accent-font-base);
--accent-border: var(--accent-font-dark);
--button-text: var(--accent-button-text);
--button-background: var(--accent-button-background);
--button-hover-text: var(--accent-button-hover-text);
--button-hover-background: var(--accent-button-hover-background);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ Dark.args = {
theme: "tna-template--dark-theme",
};

// export const System = Template.bind({});
// System.args = {
// theme: "tna-template--system-theme",
// };

export const HighContrast = Template.bind({});
HighContrast.args = {
theme: "tna-template--high-contrast-theme",
Expand Down
4 changes: 2 additions & 2 deletions src/nationalarchives/utilities/lists/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ ol {
cursor: pointer;
}

&:not(#{&}--plain) {
&:not(&--plain) {
gap: spacing.space(0.5) spacing.space(1);
}

&--plain &__item {
@extend %chip-plain;
}

&:not(#{&}--plain) &__item {
&:not(&--plain) &__item {
@extend %chip-accent;
}

Expand Down
29 changes: 25 additions & 4 deletions src/nationalarchives/utilities/typography/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,31 @@ small {
-webkit-print-color-adjust: exact;
print-color-adjust: exact;

.tna-background-accent & {
@include colour.contrast;
.tna-background-accent &,
.tna-template--dark-theme .tna-background-accent-light & {
@include colour.colour-font("contrast-font-base");

@include colour.colour-background("contrast-background");

@include colour.colour-border("contrast-background");

.fa-solid {
@include colour.colour-font("contrast-icon-light");
}
}

.tna-template--system-theme .tna-background-accent-light & {
@media (prefers-color-scheme: dark) {
@include colour.colour-font("contrast-font-base");

@include colour.colour-background("contrast-background");

@include colour.colour-border("contrast-background");

.fa-solid {
@include colour.colour-font("contrast-icon-light");
}
}
}
}

Expand Down Expand Up @@ -163,7 +184,7 @@ small {
@include colour.blue-accent;
}

&:not(#{&}--plain) {
&:not(&--plain) {
@extend %chip-accent;
}
}
Expand Down Expand Up @@ -348,7 +369,7 @@ small {
@extend %chip-plain;
}

&:not(#{&}--plain) {
&:not(&--plain) {
@extend %chip-accent;
}
}
Expand Down