-
Notifications
You must be signed in to change notification settings - Fork 6
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
Implement more systematic use of colour #147
Comments
@buildit/gravity-maintainers After much thought and experimentation, I'm now leaning towards a solution along these lines: Concept
Using this approach, every UI component would become themable. Likewise, it would become very easy to add more themes (or to temporarily alter our UI colours - e.g. for seasonal events). PrototypeI have put together a prototype of this in CodePen here: https://codepen.io/cirrus/pen/wxVqxG At the time of writing, this prototype has 10 colour purposes: --grav-co-fg
--grav-co-bg
--grav-co-fg-secondary
--grav-co-bg-secondary
--grav-co-fg-primary
--grav-co-bg-primary
--grav-co-fg-tertiary
--grav-co-bg-tertiary
--grav-co-fg-neutral
--grav-co-bg-neutral
Similarly, Then, each theme should assign colours to each of those 10 custom properties such that all permitted pairings meet AA standards. The "primary", "secondary", "tertiary" and "neutral" colours are intended to be applied in the UI as follows:
The prototype displays all the pairings and calculates their respective contrast ratios. As you can see, the current assignments for "Default theme" and "Dark theme" (which are approximations of the Buildit website's current body and footer styles) don't quite meet those contrast constraints. The "crazy" theme is proof of concept (and fugly) theme, simply to demonstrate that you can in principle, choose colours that meet the necessary a11y requirements. 😛 The "new default" and "new dark" themes are experiments to see, if a slightly different assignment of existing Buildit brand colours (and also introduction of additional colours) could create more accessible themes. Questions
Please chime in with thoughts, questions, ideas, etc. below. Thanks! |
Thanks to a lengthy brainstorming session with @dw-buildit, we now have a more refined concept and prototype. Rather than the fg/bg naming scheme proposed before, we instead divide the set of colour purposes (which each colour scheme then assigns actual colour values to) into 2 layers. Any colour from the 1st layer may be paired with any colour from the 2nd layer and that combo will be guaranteed to have an accessible contrast ratio. There is however no requirement for colour pairs within the same layer to have any particular contrast ratio. So, when styling UI components, if something needs to be perceivable - e.g. text on a background, or the boundary of a UI control against its surrounding background - then you simply need to pick a colour from a different group than the surroundings. Colour schemes can be applied to any container (and the page itself is a container which will have a default colour scheme set on it). This not only updates the values of all the colour purposes (which are exposed as CSS custom properties), but also sets the Setting a colour scheme on a UI component that is not a container (or wrapped in one) is not supported. For the most part, we expect this to be the "atomic" components (e.g. buttons, icons, form inputs, etc.). For now we're calling them "final" components (because it's akin to a Some nice benefits this will give us are:
We came to the conclusion that the next step is to try and stress-test this idea with lots of different UI components. I have started a prototype here: https://codepen.io/cirrus/project/editor/AyaaEd which aims to do just that.
|
Instead of SASS vars that get compiled to explicit values, Gravity now uses CSS custom properties. This allows color values to be overridden via the CSS cascade, so different parts of a page can have different color schemes applied to them. BREAKING CHANGE: All `grav-co-*` SASS vars have been removed. The new CSS custom properties should be used instead. fix #147
This class, which highlights a section with a darker background color, is redundant with the new color system. BREAKING CHANGE: The `.grav-o-container-banner` CSS class has been removed. You should now use a `.grav-u-color-scheme-*` class instead. re #147
Instead of SASS vars that get compiled to explicit values, Gravity now uses CSS custom properties. This allows color values to be overridden via the CSS cascade, so different parts of a page can have different color schemes applied to them. BREAKING CHANGE: All `grav-co-*` SASS vars have been removed. The new CSS custom properties should be used instead. fix #147
This class, which highlights a section with a darker background color, is redundant with the new color system. BREAKING CHANGE: The `.grav-o-container-banner` CSS class has been removed. You should now use a `.grav-u-color-scheme-*` class instead. re #147
Instead of SASS vars that get compiled to explicit values, Gravity now uses CSS custom properties. This allows color values to be overridden via the CSS cascade, so different parts of a page can have different color schemes applied to them. BREAKING CHANGE: All `grav-co-*` SASS vars have been removed. The new CSS custom properties should be used instead. fix #147
This class, which highlights a section with a darker background color, is redundant with the new color system. BREAKING CHANGE: The `.grav-o-container-banner` CSS class has been removed. You should now use a `.grav-u-color-scheme-*` class instead. re #147
Instead of SASS vars that get compiled to explicit values, Gravity now uses CSS custom properties. This allows color values to be overridden via the CSS cascade, so different parts of a page can have different color schemes applied to them. BREAKING CHANGE: All `grav-co-*` SASS vars have been removed. The new CSS custom properties should be used instead. fix #147
This class, which highlights a section with a darker background color, is redundant with the new color system. BREAKING CHANGE: The `.grav-o-container-banner` CSS class has been removed. You should now use a `.grav-u-color-scheme-*` class instead. re #147
Previously colors and color schemes were defined as SASS vars in this library's code. Those definitions have now been migrated to the `gravity-particles` library. This change updates `gravity-ui-web` to use that new library and removes the now redundant local color(-scheme) definitions. BREAKING CHANGE: All `$grav-co-*` color value SASS vars have been removed. Only the `$grav-co-scheme-*` color schemes remain. re #149, re #147
Instead of SASS vars that get compiled to explicit values, Gravity now uses CSS custom properties. This allows color values to be overridden via the CSS cascade, so different parts of a page can have different color schemes applied to them. BREAKING CHANGE: All `grav-co-*` SASS vars have been removed. The new CSS custom properties should be used instead. fix #147
Instead of SASS vars that get compiled to explicit values, Gravity now uses CSS custom properties. This allows color values to be overridden via the CSS cascade, so different parts of a page can have different color schemes applied to them. BREAKING CHANGE: All `grav-co-*` SASS vars have been removed. The new CSS custom properties should be used instead. fix #147
This class, which highlights a section with a darker background color, is redundant with the new color system. BREAKING CHANGE: The `.grav-o-container-banner` CSS class has been removed. You should now use a `.grav-u-color-scheme-*` class instead. re #147
Previously colors and color schemes were defined as SASS vars in this library's code. Those definitions have now been migrated to the `gravity-particles` library. This change updates `gravity-ui-web` to use that new library and removes the now redundant local color(-scheme) definitions. BREAKING CHANGE: All `$grav-co-*` color value SASS vars have been removed. Only the `$grav-co-scheme-*` color schemes remain. re #149, re #147
Instead of SASS vars that get compiled to explicit values, Gravity now uses CSS custom properties. This allows color values to be overridden via the CSS cascade, so different parts of a page can have different color schemes applied to them. BREAKING CHANGE: All `grav-co-*` SASS vars have been removed. The new CSS custom properties should be used instead. fix #147 affects: @buildit/gravity-ui-web
This class, which highlights a section with a darker background color, is redundant with the new color system. BREAKING CHANGE: The `.grav-o-container-banner` CSS class has been removed. You should now use a `.grav-u-color-scheme-*` class instead. re #147 affects: @buildit/gravity-ui-web
re #147 affects: @buildit/gravity-ui-web
re #147 affects: @buildit/gravity-ui-web
Previously colors and color schemes were defined as SASS vars in this library's code. Those definitions have now been migrated to the `gravity-particles` library. This change updates `gravity-ui-web` to use that new library and removes the now redundant local color(-scheme) definitions. BREAKING CHANGE: All `$grav-co-*` color value SASS vars have been removed. Only the `$grav-co-scheme-*` color schemes remain. re #149, re #147 affects: @buildit/gravity-ui-web
re #147 affects: @buildit/gravity-ui-web
re #147 affects: @buildit/gravity-ui-web
Instead of SASS vars that get compiled to explicit values, Gravity now uses CSS custom properties. This allows color values to be overridden via the CSS cascade, so different parts of a page can have different color schemes applied to them. BREAKING CHANGE: All `grav-co-*` SASS vars have been removed. The new CSS custom properties should be used instead. fix #147 affects: @buildit/gravity-ui-web
This class, which highlights a section with a darker background color, is redundant with the new color system. BREAKING CHANGE: The `.grav-o-container-banner` CSS class has been removed. You should now use a `.grav-u-color-scheme-*` class instead. re #147 affects: @buildit/gravity-ui-web
re #147 affects: @buildit/gravity-ui-web
re #147 affects: @buildit/gravity-ui-web
Previously colors and color schemes were defined as SASS vars in this library's code. Those definitions have now been migrated to the `gravity-particles` library. This change updates `gravity-ui-web` to use that new library and removes the now redundant local color(-scheme) definitions. BREAKING CHANGE: All `$grav-co-*` color value SASS vars have been removed. Only the `$grav-co-scheme-*` color schemes remain. re #149, re #147 affects: @buildit/gravity-ui-web
re #147 affects: @buildit/gravity-ui-web
re #147 affects: @buildit/gravity-ui-web
Closed by PR #219 |
🎉 This issue has been resolved in version 3.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Our modest 4 page website designs already include many different styles of links and also a button. The use of colour for those interactive elements is very ad hoc as we never defined any clear guidance or rules.
This story is to establish and implement a more systematic use of colour with the goal of encouraging (enforcing?) more consistent usage in the future.
The text was updated successfully, but these errors were encountered: