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 a992b59 commit 3cb5144Copy full SHA for 3cb5144
src/components/color/index.js
@@ -57,6 +57,16 @@ color.combine = function(front, back) {
57
return tinycolor(fcflat).toRgbString();
58
};
59
60
+color.contrast = function(cstr, lightAmount, darkAmount) {
61
+ var tc = tinycolor(cstr);
62
+
63
+ var newColor = tc.isLight() ?
64
+ tc.darken(darkAmount) :
65
+ tc.lighten(lightAmount);
66
67
+ return newColor.toString();
68
+};
69
70
color.stroke = function(s, c) {
71
var tc = tinycolor(c);
72
s.style({'stroke': color.tinyRGB(tc), 'stroke-opacity': tc.getAlpha()});
0 commit comments