Skip to content

Commit

Permalink
ID-426 Improve nav hover style.
Browse files Browse the repository at this point in the history
Secondary nav hover style was set to a darkened version of the secondary colour, but if the text is dark it makes more sense for hover to go lighter. Have implemented this with the contrast function.
  • Loading branch information
halfninja committed Sep 25, 2024
1 parent 9760f97 commit 0ea3687
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions less/mixins/branding.less
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,19 @@
@primary: @colour;
@primary-contrast: #wcag.contrast(@primary, white, @text-color)[@result];

// don't use directly, use @secondary
@base-secondary: tint(@colour, 30%);
// "private" values
@_base-secondary: tint(@colour, 30%);
@_secondary-result: #wcag.ultra-contrast(@_base-secondary, white, @text-color);

// ultra-contrast may end up darkening or lightening the background to achieve AA
@secondary-calc-msg: #wcag.ultra-contrast(@base-secondary, white, @text-color)[@msg];
@secondary: #wcag.ultra-contrast(@base-secondary, white, @text-color)[@bg];
@secondary-contrast: #wcag.ultra-contrast(@base-secondary, white, @text-color)[@fg];
@secondary-calc-msg: @_secondary-result[@msg];
@secondary: @_secondary-result[@bg];
@secondary-contrast: @_secondary-result[@fg];
// Used for some minor link hover states
@secondary-accent: multiply(@secondary, darken(white, 20%));
@secondary-accent: #wcag.contrast(@secondary-contrast,
multiply(@secondary, darken(white, 20%)),
tint(@secondary, 30%)
)[@result];

// A colour we can place on white. For links and headings
@white-emphasis: #wcag.contrast-fallback(white, @primary, @text-color)[@result];
Expand Down

0 comments on commit 0ea3687

Please sign in to comment.