We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c17371a commit d6d1e9eCopy full SHA for d6d1e9e
src/components/color/index.js
@@ -167,19 +167,26 @@ const cleanOne = val => {
167
return 'rgb(' + rgbStr + ')';
168
}
169
170
-const isDark = cstr => color(cstr).isDark()
+const equals = (cstr1, cstr2) => cstr1 && cstr2 && color(cstr1).rgb().string() === color(cstr2).rgb().string();
171
+
172
+const isValid = cstr => {
173
+ try { return !!color(cstr); }
174
+ catch { return false; }
175
+}
176
177
module.exports = {
178
addOpacity,
179
background,
180
clean,
181
+ color,
182
combine,
183
contrast,
184
defaultLine,
185
defaults,
186
+ equals,
187
fill,
188
interpolate,
- isDark,
189
+ isValid,
190
lightLine,
191
opacity,
192
rgb,
0 commit comments