-
Notifications
You must be signed in to change notification settings - Fork 335
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
Should all colours be mapped to a variable name by default #920
Comments
For context, the colours used to be defined as variables, but this was changed to a map in #777. The intention behind this change was to avoid hard-coding our palette into the public API, because:
It also:
One suggested alternative is that we could move the 'applied' colour palette (e.g.
I appreciate that it seemingly makes things slightly harder for the user, because there are two different ways to get a colour depending on whether you're referencing the palette or an 'application' of a colour. One final thing to note is that I think that whilst we're not there yet, we want to be moving towards consistently abstracting component colours, so every component would have e.g.
There then would be consistency (of sorts) because you would never (or at least rarely) be referencing the palette from the CSS itself. |
I follow the reasons, but this feels like exposing technical limitations to the user. As a user it is significantly harder to know about and remember two different approaches to using colours, and know about and remember which to use when. |
Just to note we had a support request where part of the problem was using $:
when this is correct:
|
The colour palette (blue, red, green…) is defined using a map and accessed using a function. Applications of colour (error colour, focus colour) are defined as variables. The reason for the different treatments is covered in #920 (comment)
|
I've added the Triage label to this as I think this issue might be something we can address or close as part of the colour palette and WCAG changes. |
We're going to close this as we think this is the right approach, for the reasons outlined in the initial reply. We have updated the Design System to be more consistent about how we talk about the colour palette and the various applications of colour (e.g. If we do continue to see confusion around the different ways of accessing colours we could consider ways that we could improve the documentation to make it clearer. |
After using the colour palette I'm wondering if all the colours should be mapped to a variable name? I was having to jump back and forth between code and documentation to see if a particular colour was already a predefined variable or a reference in the
govuk-colour
map. e.g.The text was updated successfully, but these errors were encountered: