1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.isContrastColorWhite = void 0;
|
4 | var tslib_1 = require("tslib");
|
5 | var color_util_1 = (0, tslib_1.__importDefault)(require("@antv/color-util"));
|
6 |
|
7 | var preset = {
|
8 | '#5B8FF9': true,
|
9 | };
|
10 |
|
11 |
|
12 |
|
13 | var isContrastColorWhite = function (color) {
|
14 | var rgb = color_util_1.default.toRGB(color).toUpperCase();
|
15 | if (preset[rgb]) {
|
16 | return preset[rgb];
|
17 | }
|
18 | var _a = color_util_1.default.rgb2arr(rgb), r = _a[0], g = _a[1], b = _a[2];
|
19 | var isDark = (r * 299 + g * 587 + b * 114) / 1000 < 128;
|
20 | return isDark;
|
21 | };
|
22 | exports.isContrastColorWhite = isContrastColorWhite;
|
23 |
|
\ | No newline at end of file |