You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Create siteVariables palette interface with color names #423
Each component should have the ability to change its color through the color prop. The color value should be available as part of a predefined palette.
Proposed solution
Create siteVariables palette interface with color names.
We should define our criteria for a good color palette so we know what we're aiming for. An artists palette is quite different from the Material Color System, for example. This is because their goals are completely different.
We might have some goals like this for starters:
Engineering Friendly - Allow programmatic generation / adaptation of color lightness
Learn Once - Provide a naming scheme that is predictable and scales across all colors and purposes
Design Focused - Similar to the needs of an artist, the palette should lend itself to useful design work over scientific correctness
Resources
Let's consider more information before suggesting a palette.
The short of it is that cultures develop words for specific areas of the spectrum in a predictable order, regardless of their language. We first identify black, white, and red. Then as the language develops, yellow and green, etc. Example, English has 11 main color words but Russian has 12:
This eventually produced the World Color Survey to determine how humans classify colors. I think the test of 2,600 languages, 110 countries, and several thousands of generations is a strong basis to start with. Humans have take a very long time to come up with the words that are most helpful in communicating color, we should pay very close attention to the color ranges of these words across the worlds most influential languages.
Design & Engineering
Though design guides and frameworks have hardly existed at all compared to natural language, we can at least look at the most useful and influential design guides and frameworks to see what they have done. Try https://styleguides.io as a starting point for finding guides and frameworks.
We should also compile a list of guides and frameworks that we deem reputable and useful references for these kinds of decisions.
Color wheel
Artists have also been trying to figure out the most useful palette of colors for as long as humans have been creating imagery. We should take a look at these sources as well: https://en.wikipedia.org/wiki/Color_wheel
It is worth noting that there are also several versions of the color wheel based on different methodologies such as artistic, pigment color, spectral color, etc.
Conclusion
Someone should touch up the criteria proposed, catch up on these resources, do some basic comparative analysis, and propose a potentially most ideal color palette.
I've analyzed a little ton of stuff, let's summarize it. I will take numbers from
community frameworks because the most of corporate frameworks doesn't work with natural color names.
I've tried to dogfood some ideas in #451. You can pull the branch and try it:
Preview
Base/Core/YOUR_NAME colors
White and black colors can't have a palette, what will be darker than #000000? Or lighter than #ffffff? It will be confusing. However, it's reasonable to allow define black and white colors, even Teams use #252423 as black.
Proton also separate white color. But, I should note that Primer has fades for white and black colors. I'm not sure that it's the best idea.
typeBaseColors={black: stringwhite: string}
Natural colors
The idea above changes the core palette a little. In #451 I used colors from Proton. This gives us 9 colors which are presented by the NaturalPalettes type.
Color
Value
Blue
#0060df
Green
#12bc00
Grey
#4a4a4f
Orange
#d76e00
Pink
#ed00b5
Purple
#8000d7
Teal
#00c8d7
Red
#d70022
Yellow
#d7b600
Each color is presented by its palette, each palette contains 7 gradients of colors: lightest, lighter, light, base, dark, darker, darkest. All of these is defined in the ColorPalette type.
(!) I've decided to go with semantic names, just compare colors.red.100 vs colors.red.lightest. However, this doesn't fit needs of Teams which has 8 colors in brand.
A palette for a color can be filled manually of by util:
We decided to go with primary (i.e. brand) and secondary colors, however I think that this palette should be increased with info, positive/success, negative/error, warning. The easiest case where these colors can be needed is Message or Form component. These colors are also defined in Bulma and Bootstrap for example.
I also think that we need a separate palette for text like this done in Alfabank Styleguide, it's not correct to use grey color for text. For example, a disabled or timestamp variations for text.
State colors can be just aliases for natural colors:
Includes only white and black that are will be represented by the string type.
2. NaturalColors
Will include 9 colors (blue, green, grey, orange, pink, purple, teal, red, yellow) as we decided before, each color should implement the ColorVariants type.
3. ContextualColors
We decided to go with ContextualColors instead of StateColors because it's more intuitive. This type will include: primary, secondary, text, danger, info, success, warning.
ColorPalette
All color types are unioned to the ColorPalette which will be exported. Names of types can be changed if we will find out a better name.
Utils
createPalette()
This util will create a color from a passed base color.
unsupportedColorVariants(), unsupportedColor()
These utils will throw a warning if you will try to access to a color or a variant that it is not supported by your theme.
Variants
We decided to go with numeric values instead of semantic, the main advantage this gives us more colors (10 vs 7) that will fit all out needs. The second reason - this pattern is widely used (Material, Proton, etc.)
Teams
We had a color palette that matches the described design. So, it's not a problem.
Complaisance
(!) We decided that every theme should implement our palette interfaces. For simplication we have utils that allow to block usage of colors or simply generate them.
Types and utils will be placed in the default theme.
We will get an initial implementation on this week.
Have thoroughly reviewed the discussion, have several questions that would like to clarify:
Material UI approach is not included in stats
For some reason Material UI Color System is not covered in the stats - at the same time, they provide one of the most comprehensive reviews on this topic. Frankly, was surprised a bit with that.
'On' colors (for text, icons, other content..)
Here, in the RFC, a topic of 'on' colors is not covered - i.e. content colors (of text, icons, etc) that will be displayed on primary or secondary background. Note that this aspect is a basic one for most theming approaches, as it is a key factor for accessible data presentation (consider a case where, for example, one would need to provide different text color which is dependent on whether lightest or darkest tint of primary color is used - as it is not possible to just use single, say, black color for both cases). What are the actions planned to address that?
Contextual colors - are those planned to be extensible by the client?
Cannot infer from the proposal if the set of Contextual colors may be extended by client, in order to address needs that might be specific to client's domain (like calling-alert, etc). Actually, if we are looking towards extensible theming mechanism, I would see this question being addressed (or would expect to see a plan of how we are going to address it).
What is proposed workflow for the client to generate color palette?
It is not absolutely clear from RFC what is the workflow client need to follow to create theme's palette. For example, the approach is clear for Bootstrap and Material:
provide primary color to us (optionally a secondary one), and palette will be generated - from the set of colors that are defined by framework. So, just one or two colors as an input.
is the same logic planned behind createPalette? If yes
what is the number of output colors planned? (would it be a reasonably minimal number)?
is it possible to provide secondary color there - and, if not, how it is possible to introduce notion of secondary color to generated palette?
ok, this is the generated palette (with a minimal necessary amount of colors), let us know if more tint variations to each base color should be generated.
now you have al the base colors (natural ones) - please, bind them to contextual ones that are planned in your app. Here, once again, I would expect that we would have some mechanism to make this set of contextual colors being extensible
need to fine-tune colors of the generated-so-far palette - please, do it, and be assured that those colors you will pick will still be WCAG-conformant, because if there would be any potential problem of low contrast for any variation of background and text color, we will let you know.
Oleksandr Fediashov (@layershifter), the last point (related to user's workflow) to my mind is a crucial one, especially if we would state that color palette is a mandatory attribute of any theme. Could you, please, suggest what is our vision here?
'On' colors (for text, icons, other content..)
What are the actions planned to address that?
Accessibility is a very important thing, but it is not covered by this RFC. We cannot cover all aspects in single run.
We discussed in offline that one of next steps will be implementation of color pairing tool that will allow to combine colors from palette and will cover accessibility aspects. We don't have an issue for that, yet.
Contextual colors - are those planned to be extensible by the client?
The AdditionalColors type covers this. These colors aren't included to siteVariables.colors (i.e. ColorPallette), but can be accessed as siteVariables.additionalColors.
What is proposed workflow for the client to generate color palette?
Activity
layershifter commentedon Nov 6, 2018
Should we use the SUI palette there?
https://semantic-ui.com/usage/theming.html#sitewide-defaults
Should we also add a
whitecolor?levithomason commentedon Nov 6, 2018
🌟 Criteria
We should define our criteria for a good color palette so we know what we're aiming for. An artists palette is quite different from the Material Color System, for example. This is because their goals are completely different.
We might have some goals like this for starters:
Resources
Let's consider more information before suggesting a palette.
Natural Language Colors
There is a lot of mind blowing research on the development of color names in natural language around the globe. Take 6min to watch "The surprising pattern behind color names around the world
".
The short of it is that cultures develop words for specific areas of the spectrum in a predictable order, regardless of their language. We first identify black, white, and red. Then as the language develops, yellow and green, etc. Example, English has 11 main color words but Russian has 12:
This eventually produced the World Color Survey to determine how humans classify colors. I think the test of 2,600 languages, 110 countries, and several thousands of generations is a strong basis to start with. Humans have take a very long time to come up with the words that are most helpful in communicating color, we should pay very close attention to the color ranges of these words across the worlds most influential languages.
Design & Engineering
Though design guides and frameworks have hardly existed at all compared to natural language, we can at least look at the most useful and influential design guides and frameworks to see what they have done. Try https://styleguides.io as a starting point for finding guides and frameworks.
We should also compile a list of guides and frameworks that we deem reputable and useful references for these kinds of decisions.
Color wheel
Artists have also been trying to figure out the most useful palette of colors for as long as humans have been creating imagery. We should take a look at these sources as well: https://en.wikipedia.org/wiki/Color_wheel
It is worth noting that there are also several versions of the color wheel based on different methodologies such as artistic, pigment color, spectral color, etc.
Conclusion
Someone should touch up the criteria proposed, catch up on these resources, do some basic comparative analysis, and propose a potentially most ideal color palette.
layershifter commentedon Nov 7, 2018
Common UI frameworks
Bootstrap, colors
primaryandsecondaryas theme colorsPalette
Blue#007bffCyan#17a2b8Green#28a745Indigo#6610f2Orange#fd7e14Pink#e83e8cPurple#6f42c1Teal#20c997Red#dc3545Yellow#ffc107Primary#007bff$blueSecondary#6c757d$gray-600Success#28a745$greenInfo#17a2b8$infoWarning#ffc107$warningDanger#dc3545$dangerLight#f8f9fa$lightDark#343a40$darkBulma, colors
primaryPalette
Blackhsl(0, 0%, 4%)Darkhsl(0, 0%, 21%)Dangerhsl(348, 100%, 61%)Lighthsl(0, 0%, 96%)Linkhsl(217, 71%, 53%)Infohsl(204, 86%, 53%)Primaryhsl(171, 100%, 41%)Successhsl(141, 71%, 48%)Warninghsl(48, 100%, 67%)Whitehsl(0, 0%, 100%)Foundation, colors
primaryandsecondaryPalette
Alert#cc4b37Black#0a0a0aDark Gray#8a8a8aLight Gray#e6e6e6Medium Gray#cacacaPrimary#1779baSecondary#767676Success#3adb76Warning#ffae00White#fefefeSemantic UI, colors
primaryandsecondaryPalette
Black#000000Blue#0E6EB8Brown#A52A2AGreen#016936Grey#A0A0A0Olive#32CD32Orange#FE9A76Pink#FF1493Purple#B413ECRed#B03060Teal#008080Violet#EE82EEYellow#FFD700Primary#0E6EB8$blueSecondary#000000$blackTailwind CSS, colors
light,dark,darker)Palette
Blue#3490DCGrey#B8C2CCGreen#38C172Indigo#6574CDOrange#F6993FPink#F66D9BPurple#9561E2Red#E3342FTeal#4DC0B5Yellow#FFED4ATurret CSS, colors
primaryandsecondary100,200,300)Palette
Black#000000Dark#323236Error#D91E18Grey#616166Info#1E90FFLight#D3D3D9Primary#3455DBSecondaryrebeccapurpleSuccess#00AA00Tertiary#8B008BWarning#FF4500White#FFFFFFOthers
layershifter commentedon Nov 7, 2018
Corporate UI frameworks
Atlassian design, colors
primaryandsecondaryas theme colors50,100,200)Palette
Blue#0747A6Green#006644Purple#403294Red#BF2600Teal#008DA6Yellow#FF8B00Carbon by IBM, colors
Palette
brand-01#3d70b2brand-02#5596e6brand-03#41d6c3ui-01#ffffffui-02#f4f7fbui-03#dfe3e6ui-04#8897a2ui-05#5a6872text-01#152935text-02#5a6872text-03#cdd1d4inverse-01#ffffffinverse-02#272d33field-01#f4f7fbfield-02#ffffffhover-primary#30588chover-primary-text#294c86hover-danger#bd1427hover-secondary#3d70b2hover-rowrgba(85,150,230,.1)support-01#e0182dsupport-02#5aa700support-03#efc100support-04#5aaafaLightning Design System by Salesforce, colors
Palette
Gray 1#fffGray 2#fafaf9Gray 3#f3f2f2Gray 4#ecebeaGray 5#dddbdaGray 6#c9c7c5Gray 7#b0adabGray 8#969492Gray 9#706e6bGray 10#514f4dGray 11#3e3e3cGray 12#2b2826Accessible#0070d2Accessible - Active#005fb2Contrast#1a1b1eContrast - Active#0d0e12Dark#182337Dark - Active#253045Light#f4f6feLight - Active#e3e5edPrimary#1589eePrimary - Active#007addFabric, colors
10,20)Palette
PinkRed#750b1cRed#d13438RedOrange#da3b01Orange#ffaa44Yellow#fce100OrangeYellow#c19c00YellowGreen#8cbd18Green#498205GreenCyan#00ad56Cyan#00b7c3CyanBlue#0078d4Blue#4f6bedBlueMagenta#8378deMagenta#c239b3MagentaPink#e3008cGray#a0aeb2Primer by Github, colors
100,200,300)Palette
Black#1b1f23Blue#0366d6Gray#6a737dGreen#28a745Orange#f66a0aPurple#6f42c1Red#d73a49White#fffYellow#ffd33dProton by Fifefox, colors
50,60,70)Palette
Blue#0a84ffGreen#30e60bGrey#737373Ink#363959Magenta#ff1ad9Orange#ff9400Purple#9400ffRed#ff0039Teal#00feffWhite#ffffffYellow#ffe900Others
layershifter commentedon Nov 7, 2018
I've analyzed a little ton of stuff, let's summarize it. I will take numbers from
community frameworks because the most of corporate frameworks doesn't work with natural color names.
Natural vs state
Usage of natural color names in palettes
primary&secondarygreyvsgraylayershifter commentedon Nov 7, 2018
Summary
Proposed palette
I've picked colors from summary table that have >= 2 points.
#252423(taken from Teams theme)#92C353(taken from Teams theme)#CC4A31(taken from Teams theme)#C4314B(taken from Teams theme)#FFFFFF(taken from Teams theme)#F8D22A(taken from Teams theme)More colors
Some frameworks provide more colors in their palette, there are common patterns:
lightest,light,base,dark: https://evergreen.segment.com/components/colors/darkest,dark,light,lightest: https://designsystem.digital.gov/components/colors/However, I'm not sure that these colors should be a part of the default theme.
Others
layershifter commentedon Nov 8, 2018
I've tried to dogfood some ideas in #451. You can pull the branch and try it:
Preview
Base/Core/
YOUR_NAMEcolorsWhite and black colors can't have a palette, what will be darker than
#000000? Or lighter than#ffffff? It will be confusing. However, it's reasonable to allow defineblackandwhitecolors, even Teams use#252423as black.Proton also separate
whitecolor. But, I should note thatPrimerhas fades for white and black colors. I'm not sure that it's the best idea.Natural colors
The idea above changes the core palette a little. In #451 I used colors from Proton. This gives us 9 colors which are presented by the
NaturalPalettestype.#0060df#12bc00#4a4a4f#d76e00#ed00b5#8000d7#00c8d7#d70022#d7b600Each color is presented by its palette, each palette contains 7 gradients of colors:
lightest,lighter,light,base,dark,darker,darkest. All of these is defined in theColorPalettetype.(!) I've decided to go with semantic names, just compare
colors.red.100vscolors.red.lightest. However, this doesn't fit needs of Teams which has 8 colors inbrand.A palette for a color can be filled manually of by util:
State colors
We decided to go with
primary(i.e. brand) andsecondarycolors, however I think that this palette should be increased withinfo,positive/success,negative/error,warning. The easiest case where these colors can be needed isMessageorFormcomponent. These colors are also defined in Bulma and Bootstrap for example.I also think that we need a separate palette for text like this done in Alfabank Styleguide, it's not correct to use
greycolor for text. For example, adisabledortimestampvariations for text.State colors can be just aliases for natural colors:
layershifter commentedon Nov 19, 2018
The final decisions that will go to RFC.
Naming
1.
PrimitiveColorsIncludes only
whiteandblackthat are will be represented by thestringtype.2.
NaturalColorsWill include 9 colors (
blue,green,grey,orange,pink,purple,teal,red,yellow) as we decided before, each color should implement theColorVariantstype.3.
ContextualColorsWe decided to go with
ContextualColorsinstead ofStateColorsbecause it's more intuitive. This type will include:primary,secondary,text,danger,info,success,warning.ColorPaletteAll color types are unioned to the
ColorPalettewhich will be exported. Names of types can be changed if we will find out a better name.Utils
createPalette()This util will create a color from a passed base color.
unsupportedColorVariants(),unsupportedColor()These utils will throw a warning if you will try to access to a color or a variant that it is not supported by your theme.
Variants
We decided to go with numeric values instead of semantic, the main advantage this gives us more colors (10 vs 7) that will fit all out needs. The second reason - this pattern is widely used (Material, Proton, etc.)
Teams
We had a color palette that matches the described design. So, it's not a problem.
Complaisance
(!) We decided that every theme should implement our palette interfaces. For simplication we have utils that allow to block usage of colors or simply generate them.
Types and utils will be placed in the default theme.
We will get an initial implementation on this week.
kuzhelov commentedon Dec 3, 2018
Have thoroughly reviewed the discussion, have several questions that would like to clarify:
Material UI approach is not included in stats
For some reason Material UI Color System is not covered in the stats - at the same time, they provide one of the most comprehensive reviews on this topic. Frankly, was surprised a bit with that.
'On' colors (for text, icons, other content..)
Here, in the RFC, a topic of 'on' colors is not covered - i.e. content colors (of text, icons, etc) that will be displayed on
primaryorsecondarybackground. Note that this aspect is a basic one for most theming approaches, as it is a key factor for accessible data presentation (consider a case where, for example, one would need to provide different text color which is dependent on whether lightest or darkest tint ofprimarycolor is used - as it is not possible to just use single, say,blackcolor for both cases). What are the actions planned to address that?Note that this is quite important topic from accessibility perspective, as this question is one of the key that defines whether app's content will be accessible or not, according to WCAG accessibility rating of level (https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html).
Contextualcolors - are those planned to be extensible by the client?Cannot infer from the proposal if the set of
Contextualcolors may be extended by client, in order to address needs that might be specific to client's domain (likecalling-alert, etc). Actually, if we are looking towards extensible theming mechanism, I would see this question being addressed (or would expect to see a plan of how we are going to address it).What is proposed workflow for the client to generate color palette?
It is not absolutely clear from RFC what is the workflow client need to follow to create theme's palette. For example, the approach is clear for Bootstrap and Material:
createPalette? If yessecondarycolor there - and, if not, how it is possible to introduce notion ofsecondarycolor to generated palette?naturalones) - please, bind them tocontextualones that are planned in your app. Here, once again, I would expect that we would have some mechanism to make this set of contextual colors being extensibleOleksandr Fediashov (@layershifter), the last point (related to user's workflow) to my mind is a crucial one, especially if we would state that color palette is a mandatory attribute of any theme. Could you, please, suggest what is our vision here?
layershifter commentedon Dec 3, 2018
I agree, it's strange that I missed it. However, if you will check #451, the result is quite similar to Material UI 😄
https://material.io/design/color/the-color-system.html#tools-for-picking-colors
Accessibility is a very important thing, but it is not covered by this RFC. We cannot cover all aspects in single run.
We discussed in offline that one of next steps will be implementation of color pairing tool that will allow to combine colors from palette and will cover accessibility aspects. We don't have an issue for that, yet.
Something like this browser's tool:

https://design.firefox.com/photon/visuals/color.html#accessibility
The
AdditionalColorstype covers this. These colors aren't included tositeVariables.colors(i.e.ColorPallette), but can be accessed assiteVariables.additionalColors.PR contains two palettes:
https://github.com/stardust-ui/react/pull/451/files#diff-c29ebf6447647ff3c88ba3381b1afbcb
https://github.com/stardust-ui/react/pull/451/files#diff-a5676258cb98e8e7e5310b952649c6dc
You can reference them as example. For now, I don't have more there. For next iteration our themes should use our color palette.
These aspects should covered as part of theming guide I think.
P.S. I renamed
createPalettetocreateColorVariantsbecause the name was confusing.