@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 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