[DO NOT MERGE] Prototype new colour palette #6266
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Important
This is for prototyping only and should not be merged int
main
A draft implementation of a system for accessing the new colour palette in govuk-frontend. Creates a new colour map, a very rough mapping of the existing palette to the new palette and applies that mapping across govuk-frontend.
This brand existing enables us to call #6255 done.
How it works
This builds on top of the
govuk-colour
sass function. It will first look to see if the colour key parsed to the function exists in$govuk-brand-colours
over$govuk-colours
. If it does, it tries to find the corresponding$variant
, with a default of "primary" and a fallback for colours where there's just one ie: white being just#FFFFFF
.If it can't find the key in the new colours map, it will look for that key in the old map instead. If it can't find it there it will error.
The list of possible colours and their variants can be found in _colours-palette.scss
Examples
govuk-colour("green")
will return the new#11875a
rather than#00703c
because green exists in both palette maps and the function prioritises$govuk-brand-colours
and uses "primary" as a default for$variant
govuk-colour("green", $variant: "tint-80") will return
#cfe7de` because that's the specified 80% tint of the primary greengovuk-colour("dark-grey")
will return##505a5f
because "dark-grey" doesn't exist as a map key in the new colours map so it looks in the old one insteadgovuk-colour("maroon")
will error because "maroon" doesn't exist in either colours mapsgovuk-colour("red", $variant: "marinara-sauce")
will error because whilst there is a red colour in the new and old palette, there isn't a marinara variantNotes
I've decided to not touch any instance where we're using
govuk-shade
orgovuk-tint
except where there's a very clear 1 to 1 mapping to the new palette eg: in the rebranded template colour. This feels too tricky for me to just do on my own based on best guesses.It's worth noting that tint and shades exist exclusively in the following components:
The 4 of them probably need some special attention