|
| 1 | +import { Provider, ProviderConsumer } from '@stardust-ui/react' |
| 2 | +import * as faker from 'faker' |
| 3 | +import * as _ from 'lodash' |
| 4 | +import * as React from 'react' |
| 5 | +import { Grid, Header } from 'semantic-ui-react' |
| 6 | + |
| 7 | +import ColorBox, { colorBoxStyles, colorBoxVariables } from 'docs/src/components/ColorBox' |
| 8 | +import ColorVariants, { colorVariantsStyles } from 'docs/src/components/ColorVariants' |
| 9 | +import DocPage from 'docs/src/components/DocPage/DocPage' |
| 10 | + |
| 11 | +const ColorPalette = () => ( |
| 12 | + <Provider |
| 13 | + theme={{ |
| 14 | + componentStyles: { |
| 15 | + ColorBox: colorBoxStyles, |
| 16 | + ColorVariants: colorVariantsStyles, |
| 17 | + }, |
| 18 | + componentVariables: { |
| 19 | + ColorBox: colorBoxVariables, |
| 20 | + }, |
| 21 | + }} |
| 22 | + > |
| 23 | + <ProviderConsumer |
| 24 | + render={({ siteVariables: { colors, contextualColors, emphasisColors, naturalColors } }) => ( |
| 25 | + <DocPage title="Color Palette"> |
| 26 | + <Header as="h2">Introduction</Header> |
| 27 | + <p> |
| 28 | + The color palette for a theme has many requirements and constraints. There is a need to |
| 29 | + be intentional and functional with color use. We analyzed existing frameworks and picked |
| 30 | + the best ideas from them. |
| 31 | + </p> |
| 32 | + <p> |
| 33 | + Each theme should match our color palette types fully. This will allow you to use our |
| 34 | + theming features completely and keep your palette structured. |
| 35 | + </p> |
| 36 | + |
| 37 | + <Header as="h2">Primitive colors</Header> |
| 38 | + <p> |
| 39 | + This part of the palette includes only <i>black</i> and <i>white</i> colors, we decided |
| 40 | + to separate by semantical ideas. There is nothing blacker than black and nothing whiter |
| 41 | + than white. |
| 42 | + </p> |
| 43 | + |
| 44 | + <Grid columns={2}> |
| 45 | + {_.map(['black', 'white'], color => ( |
| 46 | + <Grid.Column key={color}> |
| 47 | + <ColorBox name={color} rounded size="big" value={colors[color]} /> |
| 48 | + </Grid.Column> |
| 49 | + ))} |
| 50 | + </Grid> |
| 51 | + |
| 52 | + <Header as="h2">Natural colors</Header> |
| 53 | + <p> |
| 54 | + This part of palette includes nine colors (note, this number might be different for |
| 55 | + non-default theme) that are the most frequently used among popular frameworks. Each |
| 56 | + color includes ten gradients, this allows us to satisfy most common needs. This decision |
| 57 | + is experienced from Material UI and allows to define more variants than semantical |
| 58 | + naming (lightest, lighter, etc.). |
| 59 | + </p> |
| 60 | + |
| 61 | + <Grid columns={2}> |
| 62 | + {_.map(naturalColors, (variants, color) => ( |
| 63 | + <Grid.Column key={color}> |
| 64 | + <ColorBox name={color} rounded value={colors[color][500]} /> |
| 65 | + </Grid.Column> |
| 66 | + ))} |
| 67 | + </Grid> |
| 68 | + |
| 69 | + <Header as="h2">Emphasis colors</Header> |
| 70 | + <p>This part of the palette includes primary and secondary colors.</p> |
| 71 | + |
| 72 | + <Grid columns={2}> |
| 73 | + {_.map(emphasisColors, (variants, color) => ( |
| 74 | + <Grid.Column key={color}> |
| 75 | + <ColorBox name={color} rounded size="big" value={colors[color][500]} /> |
| 76 | + </Grid.Column> |
| 77 | + ))} |
| 78 | + </Grid> |
| 79 | + |
| 80 | + <Header as="h2">Contextual colors</Header> |
| 81 | + <p> |
| 82 | + Contextual colors can be used to provide "meaning through colors", however they can be |
| 83 | + just aliases for natural colors. |
| 84 | + </p> |
| 85 | + |
| 86 | + <Grid columns={2}> |
| 87 | + {_.map(contextualColors, (variants, color) => ( |
| 88 | + <Grid.Column key={color}> |
| 89 | + <ColorBox name={color} rounded size="big" value={colors[color][500]} /> |
| 90 | + </Grid.Column> |
| 91 | + ))} |
| 92 | + </Grid> |
| 93 | + |
| 94 | + <Header as="h2">Text colors</Header> |
| 95 | + <p> |
| 96 | + Text variants are also provided as a separate color because in the most cases it's not |
| 97 | + correct to use grey color for text. |
| 98 | + </p> |
| 99 | + |
| 100 | + {_.map(colors.text, (color, variant) => ( |
| 101 | + <ColorBox key={color} size="small" value={color}> |
| 102 | + {`${variant} | ${faker.lorem.sentence(4)}`} |
| 103 | + </ColorBox> |
| 104 | + ))} |
| 105 | + |
| 106 | + <Header as="h2">Color variables</Header> |
| 107 | + <Grid columns={2}> |
| 108 | + {_.map( |
| 109 | + { ...emphasisColors, ...contextualColors, ...naturalColors }, |
| 110 | + (variants, color) => ( |
| 111 | + <Grid.Column key={color}> |
| 112 | + <ColorVariants name={color} /> |
| 113 | + </Grid.Column> |
| 114 | + ), |
| 115 | + )} |
| 116 | + </Grid> |
| 117 | + </DocPage> |
| 118 | + )} |
| 119 | + /> |
| 120 | + </Provider> |
| 121 | +) |
| 122 | + |
| 123 | +export default ColorPalette |
0 commit comments