@bootstrap-styled/color
Version:
Qix/color wrapper for bootstrap-styled, it help you use color without worrying if the provided css color can be manipulated with color.
107 lines (97 loc) • 3.06 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ColorWrapper;
exports.ColorMock = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _color = _interopRequireDefault(require("color"));
var ColorMock = function ColorMock(color) {
var _this = this;
(0, _classCallCheck2.default)(this, ColorMock);
(0, _defineProperty2.default)(this, "hsl", function () {
return _this;
});
(0, _defineProperty2.default)(this, "isLight", function () {
return false;
});
(0, _defineProperty2.default)(this, "isDark", function () {
return false;
});
(0, _defineProperty2.default)(this, "negate", function () {
return _this;
});
(0, _defineProperty2.default)(this, "lighten", function () {
return _this;
});
(0, _defineProperty2.default)(this, "darken", function () {
return _this;
});
(0, _defineProperty2.default)(this, "alpha", function () {
return _this;
});
(0, _defineProperty2.default)(this, "saturate", function () {
return _this;
});
(0, _defineProperty2.default)(this, "desaturate", function () {
return _this;
});
(0, _defineProperty2.default)(this, "grayscale", function () {
return _this;
});
(0, _defineProperty2.default)(this, "whiten", function () {
return _this;
});
(0, _defineProperty2.default)(this, "blacken", function () {
return _this;
});
(0, _defineProperty2.default)(this, "fade", function () {
return _this;
});
(0, _defineProperty2.default)(this, "opaquer", function () {
return _this;
});
(0, _defineProperty2.default)(this, "rotate", function () {
return _this;
});
(0, _defineProperty2.default)(this, "contrast", function () {
return 10;
});
(0, _defineProperty2.default)(this, "luminosity", function () {
return 0.5;
});
(0, _defineProperty2.default)(this, "mix", function () {
return _this;
});
(0, _defineProperty2.default)(this, "blue", function () {
return _this.toString();
});
(0, _defineProperty2.default)(this, "green", function () {
return _this.toString();
});
(0, _defineProperty2.default)(this, "red", function () {
return _this.toString();
});
(0, _defineProperty2.default)(this, "hex", function () {
return _this.toString();
});
(0, _defineProperty2.default)(this, "rgbNumber", function () {
return _this.toString();
});
(0, _defineProperty2.default)(this, "rgb", function () {
return _this.toString();
});
(0, _defineProperty2.default)(this, "toString", function () {
return _this.color;
});
this.color = color;
};
exports.ColorMock = ColorMock;
function ColorWrapper(color) {
if (typeof color === 'string' && color.indexOf('linear-gradient') !== -1) {
return new ColorMock(color);
}
return (0, _color.default)(color);
}