@micromag/core 0.3.27 → 0.3.29
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/es/utils.js +17 -1
- package/lib/utils.js +17 -0
- package/package.json +2 -2
package/es/utils.js
CHANGED
|
@@ -739,4 +739,20 @@ var validateFields = function validateFields(fields, value) {
|
|
|
739
739
|
}, true);
|
|
740
740
|
};
|
|
741
741
|
|
|
742
|
-
|
|
742
|
+
var getContrastingColor = function getContrastingColor(backgroundColor) {
|
|
743
|
+
var _ref = backgroundColor || {},
|
|
744
|
+
_ref$color = _ref.color,
|
|
745
|
+
color = _ref$color === void 0 ? 'white' : _ref$color;
|
|
746
|
+
|
|
747
|
+
if (tinycolor.equals(color, tinycolor('white'))) {
|
|
748
|
+
return 'lightblue';
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
if (tinycolor.equals(color, tinycolor('black'))) {
|
|
752
|
+
return 'white';
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
return tinycolor(color).spin(30).toString();
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
export { convertStyleToString, createNullableOnChange, createUseEvent, getColorAsString, getComponentFromName, getContrastingColor, getDeviceScreens, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getFontFamily as getFontFamilyFromFont, getGridLayoutName, largestRemainderRound as getLargestRemainderRound, getLayersFromBackground, getLayoutParts, getMediaFilesAsArray, getOptimalImageUrl, getScreenExtraField, getSecondsFromTime, getStyleFromBorder, getStyleFromBox, getStyleFromColor, getStyleFromContainer, getStyleFromHighlight, getStyleFromImage, getStyleFromLink, getStyleFromMargin, getStyleFromText, isImageFilled, isIos, isTextFilled$1 as isLabelFilled, isMessage, isTextFilled, isValidUrl, schemaId, setValue as setFieldValue, slug, unique, validateFields };
|
package/lib/utils.js
CHANGED
|
@@ -756,6 +756,22 @@ var validateFields = function validateFields(fields, value) {
|
|
|
756
756
|
}, true);
|
|
757
757
|
};
|
|
758
758
|
|
|
759
|
+
var getContrastingColor = function getContrastingColor(backgroundColor) {
|
|
760
|
+
var _ref = backgroundColor || {},
|
|
761
|
+
_ref$color = _ref.color,
|
|
762
|
+
color = _ref$color === void 0 ? 'white' : _ref$color;
|
|
763
|
+
|
|
764
|
+
if (tinycolor__default["default"].equals(color, tinycolor__default["default"]('white'))) {
|
|
765
|
+
return 'lightblue';
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
if (tinycolor__default["default"].equals(color, tinycolor__default["default"]('black'))) {
|
|
769
|
+
return 'white';
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
return tinycolor__default["default"](color).spin(30).toString();
|
|
773
|
+
};
|
|
774
|
+
|
|
759
775
|
Object.defineProperty(exports, 'pascalCase', {
|
|
760
776
|
enumerable: true,
|
|
761
777
|
get: function () { return changeCase.pascalCase; }
|
|
@@ -769,6 +785,7 @@ exports.createNullableOnChange = createNullableOnChange;
|
|
|
769
785
|
exports.createUseEvent = createUseEvent;
|
|
770
786
|
exports.getColorAsString = getColorAsString;
|
|
771
787
|
exports.getComponentFromName = getComponentFromName;
|
|
788
|
+
exports.getContrastingColor = getContrastingColor;
|
|
772
789
|
exports.getDeviceScreens = getDeviceScreens;
|
|
773
790
|
exports.getDisplayName = getDisplayName;
|
|
774
791
|
exports.getFieldByName = getFieldByName;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.29",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"publishConfig": {
|
|
133
133
|
"access": "public"
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "fb4684ac9e69930c0ac4d9045b5148d011e92c7b"
|
|
136
136
|
}
|