@wistia/kaleidoscope 0.0.2 → 0.0.3-beta.2f7bb686.01e04ba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/color-5p2nSL66.js +1347 -0
- package/dist/color-5p2nSL66.js.map +1 -0
- package/dist/color-BD12TVX4.d.ts +393 -0
- package/dist/{index.d.ts.map → color-BD12TVX4.d.ts.map} +1 -1
- package/dist/entries/color.d.ts +3 -0
- package/dist/entries/color.js +11 -0
- package/dist/entries/vocabulary.d.ts +3 -0
- package/dist/entries/vocabulary.js +11 -0
- package/dist/index.d.ts +3 -279
- package/dist/index.js +4 -896
- package/dist/vocabulary-DAD2PSCW.d.ts +353 -0
- package/dist/vocabulary-DAD2PSCW.d.ts.map +1 -0
- package/dist/vocabulary-T3y0E_R3.js +276 -0
- package/dist/vocabulary-T3y0E_R3.js.map +1 -0
- package/package.json +23 -15
- package/CHANGELOG.md +0 -13
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -84,6 +84,48 @@ most contrasting color available, which is always black or white and is picked b
|
|
|
84
84
|
both. Check the result with `contrast` when the ratio is load-bearing.
|
|
85
85
|
|
|
86
86
|
|
|
87
|
+
## Lightness
|
|
88
|
+
|
|
89
|
+
`getColorLightnessClassification` classifies a color by its lightness, returning 'veryDark', 'dark', midtone', or 'light'
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { getColorLightnessClassification } from '@wistia/kaleidoscope';
|
|
93
|
+
|
|
94
|
+
getColorLightnessClassification('#000000'); // 'veryDark'
|
|
95
|
+
getColorLightnessClassification('#2949e5'); // 'dark'
|
|
96
|
+
getColorLightnessClassification('#7f7f7f'); // 'midtone'
|
|
97
|
+
getColorLightnessClassification('#ffffff'); // 'light'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Accented backgrounds
|
|
101
|
+
|
|
102
|
+
Often we want a surface (a card or panel) to have a visually distinct background color derived from the main background the surface sits on.
|
|
103
|
+
|
|
104
|
+
Use these utilities only when the contrast ratio of the accented background color against the given background color is insignificant.
|
|
105
|
+
|
|
106
|
+
`getSlightAccentedBackgroundColor` is one step darker/lighter than the background
|
|
107
|
+
`getHeavyAccentedBackgroundColor` is two steps darker/lighter than the background
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import {
|
|
112
|
+
getHeavyAccentedBackgroundColor,
|
|
113
|
+
getSlightAccentedBackgroundColor,
|
|
114
|
+
} from '@wistia/kaleidoscope';
|
|
115
|
+
|
|
116
|
+
getSlightAccentedBackgroundColor('#f5f5f5').toHex(); // '#e0e0e0'
|
|
117
|
+
getHeavyAccentedBackgroundColor('#f5f5f5').toHex(); // '#cbcbcb'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Pass `primaryColor` when the background color is derived from a primary color so that the accented color
|
|
121
|
+
preserves the vibrancy of the primary color rather than getting muddy/gray.
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
getSlightAccentedBackgroundColor('#f5f5f5', { primaryColor: '#2949e5' }).toHex(); // '#cdd5f9'
|
|
125
|
+
getHeavyAccentedBackgroundColor('#f5f5f5', { primaryColor: '#2949e5' }).toHex(); // '#adbbf5'
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
|
|
87
129
|
## Storybook
|
|
88
130
|
|
|
89
131
|
Color is easier to judge by eye than by assertion, so every feature has a story, including
|