@qrvey/utils 1.13.0-7 → 1.112.2

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.
Files changed (144) hide show
  1. package/README.md +2173 -2649
  2. package/dist/charts/adapters/endpointData.js +1 -1
  3. package/dist/charts/adapters/endpointDataGet.js +1 -1
  4. package/dist/cjs/charts/adapters/endpointData.js +1 -1
  5. package/dist/cjs/charts/adapters/endpointDataGet.js +1 -1
  6. package/dist/cjs/dates/adapters/dateToMonthYear.js +1 -3
  7. package/dist/cjs/dates/constants/index.d.ts +0 -1
  8. package/dist/cjs/dates/constants/index.js +0 -1
  9. package/dist/cjs/dates/relative/RelativeStatementAdapter.d.ts +1 -1
  10. package/dist/cjs/dates/relative/RelativeStatementAdapter.js +1 -2
  11. package/dist/cjs/dates/relative/relative.d.ts +4 -3
  12. package/dist/cjs/dates/relative/relative.js +9 -5
  13. package/dist/cjs/filters/constants/common/FILTER_SCOPE.d.ts +8 -8
  14. package/dist/cjs/filters/services/Filters.api.js +7 -4
  15. package/dist/cjs/filters/services/UChartApi.d.ts +1 -1
  16. package/dist/cjs/filters/services/UChartApi.js +1 -2
  17. package/dist/cjs/filters/services/UChartPaginationApi.d.ts +1 -1
  18. package/dist/cjs/filters/services/UChartPaginationApi.js +2 -3
  19. package/dist/cjs/general/object/objectCopy.d.ts +5 -4
  20. package/dist/cjs/general/object/objectCopy.js +26 -16
  21. package/dist/cjs/services/api/getAllQrveys.api.d.ts +1 -1
  22. package/dist/cjs/services/helpers/getDefaultQuestionListOptionsAttributes.js +7 -7
  23. package/dist/cjs/services/interfaces/IPayloadQrveyAll.d.ts +1 -1
  24. package/dist/cjs/themes/constants/AUTOMATIC_CSS_VARIABLES.d.ts +0 -2
  25. package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK.d.ts +0 -1
  26. package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK.js +0 -1
  27. package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.d.ts +0 -1
  28. package/dist/cjs/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.js +0 -1
  29. package/dist/cjs/themes/constants/COLOR_TYPE.d.ts +0 -3
  30. package/dist/cjs/themes/constants/COLOR_TYPE.js +0 -3
  31. package/dist/cjs/themes/constants/CSS_VARIABLE_DESTINATION.d.ts +0 -3
  32. package/dist/cjs/themes/constants/CSS_VARIABLE_DESTINATION.js +0 -3
  33. package/dist/cjs/themes/constants/GLOBAL_CSS_VARIABLES.d.ts +1 -2
  34. package/dist/cjs/themes/constants/GLOBAL_CSS_VARIABLES.js +0 -1
  35. package/dist/cjs/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.d.ts +0 -3
  36. package/dist/cjs/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.js +0 -3
  37. package/dist/cjs/themes/constants/RGBA_REGULAR_EXPRESION.d.ts +0 -3
  38. package/dist/cjs/themes/constants/RGBA_REGULAR_EXPRESION.js +0 -3
  39. package/dist/cjs/themes/constants/index.d.ts +0 -4
  40. package/dist/cjs/themes/constants/index.js +0 -4
  41. package/dist/cjs/themes/helpers/getCSSVariablesByDestination.d.ts +6 -3
  42. package/dist/cjs/themes/helpers/getCSSVariablesByDestination.js +0 -3
  43. package/dist/cjs/themes/helpers/index.d.ts +1 -6
  44. package/dist/cjs/themes/helpers/index.js +1 -6
  45. package/dist/cjs/themes/helpers/isHexadecimalColor.js +1 -2
  46. package/dist/cjs/themes/helpers/isRGBAColor.js +1 -2
  47. package/dist/cjs/themes/helpers/lightOrDark.js +30 -14
  48. package/dist/cjs/themes/helpers/setAutomaticCSSVariablesForDark.js +1 -1
  49. package/dist/cjs/themes/interfaces/IColorCSSVariableDestination.d.ts +0 -3
  50. package/dist/cjs/themes/interfaces/IColorType.d.ts +0 -3
  51. package/dist/cjs/themes/interfaces/index.d.ts +0 -1
  52. package/dist/cjs/themes/interfaces/index.js +0 -1
  53. package/dist/dates/adapters/dateToMonthYear.js +1 -3
  54. package/dist/dates/constants/index.d.ts +0 -1
  55. package/dist/dates/constants/index.js +0 -1
  56. package/dist/dates/relative/RelativeStatementAdapter.d.ts +1 -1
  57. package/dist/dates/relative/RelativeStatementAdapter.js +1 -1
  58. package/dist/dates/relative/relative.d.ts +4 -3
  59. package/dist/dates/relative/relative.js +5 -4
  60. package/dist/filters/constants/common/FILTER_SCOPE.d.ts +8 -8
  61. package/dist/filters/services/Filters.api.js +2 -2
  62. package/dist/filters/services/UChartApi.d.ts +1 -1
  63. package/dist/filters/services/UChartApi.js +2 -1
  64. package/dist/filters/services/UChartPaginationApi.d.ts +1 -1
  65. package/dist/filters/services/UChartPaginationApi.js +3 -2
  66. package/dist/general/object/objectCopy.d.ts +5 -4
  67. package/dist/general/object/objectCopy.js +26 -16
  68. package/dist/services/api/getAllQrveys.api.d.ts +1 -1
  69. package/dist/services/helpers/getDefaultQuestionListOptionsAttributes.js +7 -7
  70. package/dist/services/interfaces/IPayloadQrveyAll.d.ts +1 -1
  71. package/dist/themes/constants/AUTOMATIC_CSS_VARIABLES.d.ts +0 -2
  72. package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK.d.ts +0 -1
  73. package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_DARK.js +0 -1
  74. package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.d.ts +0 -1
  75. package/dist/themes/constants/AUTOMATIC_GLOBAL_CSS_VARIABLES_FOR_LIGHT.js +0 -1
  76. package/dist/themes/constants/COLOR_TYPE.d.ts +0 -3
  77. package/dist/themes/constants/COLOR_TYPE.js +0 -3
  78. package/dist/themes/constants/CSS_VARIABLE_DESTINATION.d.ts +0 -3
  79. package/dist/themes/constants/CSS_VARIABLE_DESTINATION.js +0 -3
  80. package/dist/themes/constants/GLOBAL_CSS_VARIABLES.d.ts +1 -2
  81. package/dist/themes/constants/GLOBAL_CSS_VARIABLES.js +0 -1
  82. package/dist/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.d.ts +0 -3
  83. package/dist/themes/constants/HEXADECIMAL_REGULAR_EXPRESSION.js +0 -3
  84. package/dist/themes/constants/RGBA_REGULAR_EXPRESION.d.ts +0 -3
  85. package/dist/themes/constants/RGBA_REGULAR_EXPRESION.js +0 -3
  86. package/dist/themes/constants/index.d.ts +0 -4
  87. package/dist/themes/constants/index.js +0 -4
  88. package/dist/themes/helpers/getCSSVariablesByDestination.d.ts +6 -3
  89. package/dist/themes/helpers/getCSSVariablesByDestination.js +0 -3
  90. package/dist/themes/helpers/index.d.ts +1 -6
  91. package/dist/themes/helpers/index.js +1 -6
  92. package/dist/themes/helpers/isHexadecimalColor.js +1 -2
  93. package/dist/themes/helpers/isRGBAColor.js +1 -2
  94. package/dist/themes/helpers/lightOrDark.js +30 -14
  95. package/dist/themes/helpers/setAutomaticCSSVariablesForDark.js +1 -1
  96. package/dist/themes/interfaces/IColorCSSVariableDestination.d.ts +0 -3
  97. package/dist/themes/interfaces/IColorType.d.ts +0 -3
  98. package/dist/themes/interfaces/index.d.ts +0 -1
  99. package/dist/themes/interfaces/index.js +0 -1
  100. package/package.json +17 -20
  101. package/dist/cjs/dates/constants/INTL_DATE_FORMATS.d.ts +0 -1
  102. package/dist/cjs/dates/constants/INTL_DATE_FORMATS.js +0 -8
  103. package/dist/cjs/themes/constants/CHANNEL_BLACK_COLOR.d.ts +0 -5
  104. package/dist/cjs/themes/constants/CHANNEL_BLACK_COLOR.js +0 -12
  105. package/dist/cjs/themes/constants/CHANNEL_WHITE_COLOR.d.ts +0 -5
  106. package/dist/cjs/themes/constants/CHANNEL_WHITE_COLOR.js +0 -12
  107. package/dist/cjs/themes/constants/COLOR_NAME.d.ts +0 -154
  108. package/dist/cjs/themes/constants/COLOR_NAME.js +0 -157
  109. package/dist/cjs/themes/helpers/calculateHSP.d.ts +0 -8
  110. package/dist/cjs/themes/helpers/calculateHSP.js +0 -20
  111. package/dist/cjs/themes/helpers/getChannelsByHexadecimalColor.d.ts +0 -8
  112. package/dist/cjs/themes/helpers/getChannelsByHexadecimalColor.js +0 -26
  113. package/dist/cjs/themes/helpers/getChannelsByNameColor.d.ts +0 -8
  114. package/dist/cjs/themes/helpers/getChannelsByNameColor.js +0 -26
  115. package/dist/cjs/themes/helpers/getChannelsByRgbaColor.d.ts +0 -8
  116. package/dist/cjs/themes/helpers/getChannelsByRgbaColor.js +0 -25
  117. package/dist/cjs/themes/helpers/getHexadecimalOpacity.d.ts +0 -7
  118. package/dist/cjs/themes/helpers/getHexadecimalOpacity.js +0 -19
  119. package/dist/cjs/themes/helpers/getRgbaOpacity.d.ts +0 -7
  120. package/dist/cjs/themes/helpers/getRgbaOpacity.js +0 -21
  121. package/dist/cjs/themes/interfaces/IColorChannel.d.ts +0 -9
  122. package/dist/cjs/themes/interfaces/IColorChannel.js +0 -2
  123. package/dist/dates/constants/INTL_DATE_FORMATS.d.ts +0 -1
  124. package/dist/dates/constants/INTL_DATE_FORMATS.js +0 -5
  125. package/dist/themes/constants/CHANNEL_BLACK_COLOR.d.ts +0 -5
  126. package/dist/themes/constants/CHANNEL_BLACK_COLOR.js +0 -9
  127. package/dist/themes/constants/CHANNEL_WHITE_COLOR.d.ts +0 -5
  128. package/dist/themes/constants/CHANNEL_WHITE_COLOR.js +0 -9
  129. package/dist/themes/constants/COLOR_NAME.d.ts +0 -154
  130. package/dist/themes/constants/COLOR_NAME.js +0 -154
  131. package/dist/themes/helpers/calculateHSP.d.ts +0 -8
  132. package/dist/themes/helpers/calculateHSP.js +0 -16
  133. package/dist/themes/helpers/getChannelsByHexadecimalColor.d.ts +0 -8
  134. package/dist/themes/helpers/getChannelsByHexadecimalColor.js +0 -22
  135. package/dist/themes/helpers/getChannelsByNameColor.d.ts +0 -8
  136. package/dist/themes/helpers/getChannelsByNameColor.js +0 -22
  137. package/dist/themes/helpers/getChannelsByRgbaColor.d.ts +0 -8
  138. package/dist/themes/helpers/getChannelsByRgbaColor.js +0 -21
  139. package/dist/themes/helpers/getHexadecimalOpacity.d.ts +0 -7
  140. package/dist/themes/helpers/getHexadecimalOpacity.js +0 -15
  141. package/dist/themes/helpers/getRgbaOpacity.d.ts +0 -7
  142. package/dist/themes/helpers/getRgbaOpacity.js +0 -17
  143. package/dist/themes/interfaces/IColorChannel.d.ts +0 -9
  144. package/dist/themes/interfaces/IColorChannel.js +0 -1
@@ -1,9 +1,6 @@
1
1
  import { isEmpty } from "../../general/mix/isEmpty";
2
2
  import { COLOR_TYPE } from "../constants/COLOR_TYPE";
3
- import { calculateHSP } from "./calculateHSP";
4
- import { getChannelsByHexadecimalColor } from "./getChannelsByHexadecimalColor";
5
- import { getChannelsByNameColor } from "./getChannelsByNameColor";
6
- import { getChannelsByRgbaColor } from "./getChannelsByRgbaColor";
3
+ import { RGBA_REGULAR_EXPRESSION } from "../constants/RGBA_REGULAR_EXPRESION";
7
4
  import { isHexadecimalColor } from "./isHexadecimalColor";
8
5
  import { isRGBAColor } from "./isRGBAColor";
9
6
  /**
@@ -14,23 +11,42 @@ import { isRGBAColor } from "./isRGBAColor";
14
11
  * @returns the color type (Dark or Light)
15
12
  */
16
13
  export function lightOrDark(color, brightnessThreshold = 127.5, opacityThreshold = 0.5) {
17
- if (isEmpty(color) || typeof color !== "string")
14
+ if (isEmpty(color))
18
15
  return COLOR_TYPE.LIGHT;
19
- let rgbaChannel = { r: 0, g: 0, b: 0, a: 1 };
20
16
  const rgbaColor = isRGBAColor(color);
21
17
  const hexadecimalColor = isHexadecimalColor(color);
18
+ if (!rgbaColor && !hexadecimalColor)
19
+ return;
20
+ let r, g, b, a;
22
21
  if (rgbaColor) {
23
- rgbaChannel = getChannelsByRgbaColor(color);
22
+ const colors = color.match(RGBA_REGULAR_EXPRESSION);
23
+ r = Number(colors[1]);
24
+ g = Number(colors[2]);
25
+ b = Number(colors[3]);
26
+ a = rgbaOpacity(color);
24
27
  }
25
- else if (hexadecimalColor) {
26
- rgbaChannel = getChannelsByHexadecimalColor(color);
28
+ if (hexadecimalColor) {
29
+ const colorCode = +`0x${color
30
+ .slice(1)
31
+ .replace(color.length < 5 && /./g, "$&$&")}`;
32
+ r = colorCode >> 16;
33
+ g = (colorCode >> 8) & 255;
34
+ b = colorCode & 255;
35
+ a = hexadecimalOpacity(color);
27
36
  }
28
- else {
29
- rgbaChannel = getChannelsByNameColor(color);
30
- }
31
- const hsp = calculateHSP(rgbaChannel);
32
- if (hsp > brightnessThreshold || rgbaChannel.a < opacityThreshold) {
37
+ // HSP equation from http://alienryderflex.com/hsp.html
38
+ const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
39
+ if (hsp > brightnessThreshold || a < opacityThreshold) {
33
40
  return COLOR_TYPE.LIGHT;
34
41
  }
35
42
  return COLOR_TYPE.DARK;
36
43
  }
44
+ function hexadecimalOpacity(hexadecimal) {
45
+ const opacityHexa = hexadecimal.slice(7) || "FF";
46
+ return parseInt(opacityHexa, 16) / 255;
47
+ }
48
+ function rgbaOpacity(rgba) {
49
+ var _a;
50
+ const colors = rgba.match(RGBA_REGULAR_EXPRESSION);
51
+ return (_a = Number(colors[4])) !== null && _a !== void 0 ? _a : 1;
52
+ }
@@ -8,7 +8,7 @@ import { getCSSVariablesByDestination } from "./getCSSVariablesByDestination";
8
8
  * @param wrapperTags the html elements to set the CSS variables
9
9
  */
10
10
  export function setAutomaticCSSVariablesForDark(colorType, wrapperTags, destination = CSS_VARIABLE_DESTINATION.GLOBAL) {
11
- if (isEmpty(colorType) || !Array.isArray(wrapperTags))
11
+ if (isEmpty(colorType) || isEmpty(wrapperTags))
12
12
  return;
13
13
  const cssVariables = getCSSVariablesByDestination(destination);
14
14
  const cssVariablesKeys = Object.keys(cssVariables[colorType] || {});
@@ -1,5 +1,2 @@
1
1
  import { CSS_VARIABLE_DESTINATION } from "../constants/CSS_VARIABLE_DESTINATION";
2
- /**
3
- * CSS Variable Destination types
4
- */
5
2
  export type IColorCSSVariableDestination = CSS_VARIABLE_DESTINATION;
@@ -1,5 +1,2 @@
1
1
  import { COLOR_TYPE } from "../constants/COLOR_TYPE";
2
- /**
3
- * Color types
4
- */
5
2
  export type IColorType = COLOR_TYPE;
@@ -1,3 +1,2 @@
1
- export * from "./IColorChannel";
2
1
  export * from "./IColorCSSVariableDestination";
3
2
  export * from "./IColorType";
@@ -1,3 +1,2 @@
1
- export * from "./IColorChannel";
2
1
  export * from "./IColorCSSVariableDestination";
3
2
  export * from "./IColorType";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.13.0-7",
3
+ "version": "1.112.2",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",
@@ -13,7 +13,7 @@
13
13
  "lint.dev": "eslint . --debug --ext .ts,.tsx",
14
14
  "prepare": "husky install",
15
15
  "publishing.beta.1": "node ./scripts/publishing --np-new-version=$npm_config_np_new_version --np-any-branch=$npm_config_np_any_branch --np-tag=$npm_config_np_tag",
16
- "publishing": "node ./scripts/clean-build && np $npm_config_np_new_version --any-branch --tag=$npm_config_np_tag --no-yarn",
16
+ "publishing": "node ./scripts/clean-build && np $npm_config_np_new_version --any-branch --tag=$npm_config_np_tag",
17
17
  "publishing.win": "node ./scripts/clean-build && np %npm_config_np_new_version% --any-branch --tag=%npm_config_np_tag%",
18
18
  "test": "jest test --verbose",
19
19
  "test.coverage": "jest test --collect-coverage",
@@ -23,33 +23,30 @@
23
23
  "author": "Qrvey Inc",
24
24
  "license": "MIT",
25
25
  "engines": {
26
- "node": ">=18 <=20"
26
+ "node": ">=14 <=18"
27
27
  },
28
28
  "devDependencies": {
29
- "@types/jest": "29.5.11",
30
- "@typescript-eslint/eslint-plugin": "6.19.0",
31
- "@typescript-eslint/parser": "6.19.0",
29
+ "@types/jest": "29.5.3",
30
+ "@types/responselike": "1.0.0",
31
+ "@typescript-eslint/eslint-plugin": "6.2.1",
32
+ "@typescript-eslint/parser": "6.2.1",
32
33
  "auto-changelog": "2.4.0",
33
- "eslint": "8.56.0",
34
- "eslint-config-prettier": "9.1.0",
35
- "eslint-import-resolver-typescript": "3.6.1",
36
- "eslint-plugin-import": "2.29.1",
37
- "eslint-plugin-jsdoc": "48.0.2",
38
- "eslint-plugin-prettier": "5.1.3",
39
- "eslint-plugin-sonarjs": "0.23.0",
34
+ "eslint": "8.46.0",
35
+ "eslint-config-prettier": "8.9.0",
36
+ "eslint-plugin-prettier": "5.0.0",
37
+ "eslint-plugin-sonarjs": "0.19.0",
40
38
  "husky": "8.0.3",
41
- "jest": "29.7.0",
42
- "jest-environment-jsdom": "29.7.0",
43
- "lint-staged": "15.2.0",
39
+ "jest": "29.6.2",
40
+ "lint-staged": "13.2.3",
44
41
  "np": "8.0.4",
45
- "prettier": "3.2.4",
42
+ "prettier": "3.0.0",
46
43
  "ts-jest": "29.1.1",
47
- "typescript": "5.3.3"
44
+ "typescript": "5.1.6"
48
45
  },
49
46
  "dependencies": {
50
47
  "d3-format": "2.0.0",
51
- "dayjs": "1.11.10",
52
- "i18next": "23.7.16"
48
+ "dayjs": "1.11.9",
49
+ "i18next": "22.4.9"
53
50
  },
54
51
  "files": [
55
52
  "dist/**/*"
@@ -1 +0,0 @@
1
- export declare const INTL_YEAR_FORMAT: Intl.NumberFormat;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INTL_YEAR_FORMAT = void 0;
4
- exports.INTL_YEAR_FORMAT = new Intl.NumberFormat(undefined, {
5
- useGrouping: false,
6
- minimumIntegerDigits: 4,
7
- maximumSignificantDigits: 4,
8
- });
@@ -1,5 +0,0 @@
1
- import { IColorChannel } from "../interfaces/IColorChannel";
2
- /**
3
- * Default channel values for the black color
4
- */
5
- export declare const CHANNEL_BLACK_COLOR: IColorChannel;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CHANNEL_BLACK_COLOR = void 0;
4
- /**
5
- * Default channel values for the black color
6
- */
7
- exports.CHANNEL_BLACK_COLOR = {
8
- r: 0,
9
- g: 0,
10
- b: 0,
11
- a: 1,
12
- };
@@ -1,5 +0,0 @@
1
- import { IColorChannel } from "../interfaces/IColorChannel";
2
- /**
3
- * Default channel values for the white color
4
- */
5
- export declare const CHANNEL_WHITE_COLOR: IColorChannel;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CHANNEL_WHITE_COLOR = void 0;
4
- /**
5
- * Default channel values for the white color
6
- */
7
- exports.CHANNEL_WHITE_COLOR = {
8
- r: 255,
9
- g: 255,
10
- b: 255,
11
- a: 1,
12
- };
@@ -1,154 +0,0 @@
1
- /**
2
- * Collection of channel values for a related name color
3
- * The list is based on https://drafts.csswg.org/css-color/#named-colors
4
- */
5
- export declare const COLOR_NAME: {
6
- aliceblue: number[];
7
- antiquewhite: number[];
8
- aqua: number[];
9
- aquamarine: number[];
10
- azure: number[];
11
- beige: number[];
12
- bisque: number[];
13
- black: number[];
14
- blanchedalmond: number[];
15
- blue: number[];
16
- blueviolet: number[];
17
- brown: number[];
18
- burlywood: number[];
19
- cadetblue: number[];
20
- chartreuse: number[];
21
- chocolate: number[];
22
- coral: number[];
23
- cornflowerblue: number[];
24
- cornsilk: number[];
25
- crimson: number[];
26
- cyan: number[];
27
- darkblue: number[];
28
- darkcyan: number[];
29
- darkgoldenrod: number[];
30
- darkgray: number[];
31
- darkgreen: number[];
32
- darkgrey: number[];
33
- darkkhaki: number[];
34
- darkmagenta: number[];
35
- darkolivegreen: number[];
36
- darkorange: number[];
37
- darkorchid: number[];
38
- darkred: number[];
39
- darksalmon: number[];
40
- darkseagreen: number[];
41
- darkslateblue: number[];
42
- darkslategray: number[];
43
- darkslategrey: number[];
44
- darkturquoise: number[];
45
- darkviolet: number[];
46
- deeppink: number[];
47
- deepskyblue: number[];
48
- dimgray: number[];
49
- dimgrey: number[];
50
- dodgerblue: number[];
51
- firebrick: number[];
52
- floralwhite: number[];
53
- forestgreen: number[];
54
- fuchsia: number[];
55
- gainsboro: number[];
56
- ghostwhite: number[];
57
- gold: number[];
58
- goldenrod: number[];
59
- gray: number[];
60
- green: number[];
61
- greenyellow: number[];
62
- grey: number[];
63
- honeydew: number[];
64
- hotpink: number[];
65
- indianred: number[];
66
- indigo: number[];
67
- ivory: number[];
68
- khaki: number[];
69
- lavender: number[];
70
- lavenderblush: number[];
71
- lawngreen: number[];
72
- lemonchiffon: number[];
73
- lightblue: number[];
74
- lightcoral: number[];
75
- lightcyan: number[];
76
- lightgoldenrodyellow: number[];
77
- lightgray: number[];
78
- lightgreen: number[];
79
- lightgrey: number[];
80
- lightpink: number[];
81
- lightsalmon: number[];
82
- lightseagreen: number[];
83
- lightskyblue: number[];
84
- lightslategray: number[];
85
- lightslategrey: number[];
86
- lightsteelblue: number[];
87
- lightyellow: number[];
88
- lime: number[];
89
- limegreen: number[];
90
- linen: number[];
91
- magenta: number[];
92
- maroon: number[];
93
- mediumaquamarine: number[];
94
- mediumblue: number[];
95
- mediumorchid: number[];
96
- mediumpurple: number[];
97
- mediumseagreen: number[];
98
- mediumslateblue: number[];
99
- mediumspringgreen: number[];
100
- mediumturquoise: number[];
101
- mediumvioletred: number[];
102
- midnightblue: number[];
103
- mintcream: number[];
104
- mistyrose: number[];
105
- moccasin: number[];
106
- navajowhite: number[];
107
- navy: number[];
108
- oldlace: number[];
109
- olive: number[];
110
- olivedrab: number[];
111
- orange: number[];
112
- orangered: number[];
113
- orchid: number[];
114
- palegoldenrod: number[];
115
- palegreen: number[];
116
- paleturquoise: number[];
117
- palevioletred: number[];
118
- papayawhip: number[];
119
- peachpuff: number[];
120
- peru: number[];
121
- pink: number[];
122
- plum: number[];
123
- powderblue: number[];
124
- purple: number[];
125
- rebeccapurple: number[];
126
- red: number[];
127
- rosybrown: number[];
128
- royalblue: number[];
129
- saddlebrown: number[];
130
- salmon: number[];
131
- sandybrown: number[];
132
- seagreen: number[];
133
- seashell: number[];
134
- sienna: number[];
135
- silver: number[];
136
- skyblue: number[];
137
- slateblue: number[];
138
- slategray: number[];
139
- slategrey: number[];
140
- snow: number[];
141
- springgreen: number[];
142
- steelblue: number[];
143
- tan: number[];
144
- teal: number[];
145
- thistle: number[];
146
- tomato: number[];
147
- turquoise: number[];
148
- violet: number[];
149
- wheat: number[];
150
- white: number[];
151
- whitesmoke: number[];
152
- yellow: number[];
153
- yellowgreen: number[];
154
- };
@@ -1,157 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.COLOR_NAME = void 0;
4
- /**
5
- * Collection of channel values for a related name color
6
- * The list is based on https://drafts.csswg.org/css-color/#named-colors
7
- */
8
- exports.COLOR_NAME = {
9
- aliceblue: [240, 248, 255],
10
- antiquewhite: [250, 235, 215],
11
- aqua: [0, 255, 255],
12
- aquamarine: [127, 255, 212],
13
- azure: [240, 255, 255],
14
- beige: [245, 245, 220],
15
- bisque: [255, 228, 196],
16
- black: [0, 0, 0],
17
- blanchedalmond: [255, 235, 205],
18
- blue: [0, 0, 255],
19
- blueviolet: [138, 43, 226],
20
- brown: [165, 42, 42],
21
- burlywood: [222, 184, 135],
22
- cadetblue: [95, 158, 160],
23
- chartreuse: [127, 255, 0],
24
- chocolate: [210, 105, 30],
25
- coral: [255, 127, 80],
26
- cornflowerblue: [100, 149, 237],
27
- cornsilk: [255, 248, 220],
28
- crimson: [220, 20, 60],
29
- cyan: [0, 255, 255],
30
- darkblue: [0, 0, 139],
31
- darkcyan: [0, 139, 139],
32
- darkgoldenrod: [184, 134, 11],
33
- darkgray: [169, 169, 169],
34
- darkgreen: [0, 100, 0],
35
- darkgrey: [169, 169, 169],
36
- darkkhaki: [189, 183, 107],
37
- darkmagenta: [139, 0, 139],
38
- darkolivegreen: [85, 107, 47],
39
- darkorange: [255, 140, 0],
40
- darkorchid: [153, 50, 204],
41
- darkred: [139, 0, 0],
42
- darksalmon: [233, 150, 122],
43
- darkseagreen: [143, 188, 143],
44
- darkslateblue: [72, 61, 139],
45
- darkslategray: [47, 79, 79],
46
- darkslategrey: [47, 79, 79],
47
- darkturquoise: [0, 206, 209],
48
- darkviolet: [148, 0, 211],
49
- deeppink: [255, 20, 147],
50
- deepskyblue: [0, 191, 255],
51
- dimgray: [105, 105, 105],
52
- dimgrey: [105, 105, 105],
53
- dodgerblue: [30, 144, 255],
54
- firebrick: [178, 34, 34],
55
- floralwhite: [255, 250, 240],
56
- forestgreen: [34, 139, 34],
57
- fuchsia: [255, 0, 255],
58
- gainsboro: [220, 220, 220],
59
- ghostwhite: [248, 248, 255],
60
- gold: [255, 215, 0],
61
- goldenrod: [218, 165, 32],
62
- gray: [128, 128, 128],
63
- green: [0, 128, 0],
64
- greenyellow: [173, 255, 47],
65
- grey: [128, 128, 128],
66
- honeydew: [240, 255, 240],
67
- hotpink: [255, 105, 180],
68
- indianred: [205, 92, 92],
69
- indigo: [75, 0, 130],
70
- ivory: [255, 255, 240],
71
- khaki: [240, 230, 140],
72
- lavender: [230, 230, 250],
73
- lavenderblush: [255, 240, 245],
74
- lawngreen: [124, 252, 0],
75
- lemonchiffon: [255, 250, 205],
76
- lightblue: [173, 216, 230],
77
- lightcoral: [240, 128, 128],
78
- lightcyan: [224, 255, 255],
79
- lightgoldenrodyellow: [250, 250, 210],
80
- lightgray: [211, 211, 211],
81
- lightgreen: [144, 238, 144],
82
- lightgrey: [211, 211, 211],
83
- lightpink: [255, 182, 193],
84
- lightsalmon: [255, 160, 122],
85
- lightseagreen: [32, 178, 170],
86
- lightskyblue: [135, 206, 250],
87
- lightslategray: [119, 136, 153],
88
- lightslategrey: [119, 136, 153],
89
- lightsteelblue: [176, 196, 222],
90
- lightyellow: [255, 255, 224],
91
- lime: [0, 255, 0],
92
- limegreen: [50, 205, 50],
93
- linen: [250, 240, 230],
94
- magenta: [255, 0, 255],
95
- maroon: [128, 0, 0],
96
- mediumaquamarine: [102, 205, 170],
97
- mediumblue: [0, 0, 205],
98
- mediumorchid: [186, 85, 211],
99
- mediumpurple: [147, 112, 219],
100
- mediumseagreen: [60, 179, 113],
101
- mediumslateblue: [123, 104, 238],
102
- mediumspringgreen: [0, 250, 154],
103
- mediumturquoise: [72, 209, 204],
104
- mediumvioletred: [199, 21, 133],
105
- midnightblue: [25, 25, 112],
106
- mintcream: [245, 255, 250],
107
- mistyrose: [255, 228, 225],
108
- moccasin: [255, 228, 181],
109
- navajowhite: [255, 222, 173],
110
- navy: [0, 0, 128],
111
- oldlace: [253, 245, 230],
112
- olive: [128, 128, 0],
113
- olivedrab: [107, 142, 35],
114
- orange: [255, 165, 0],
115
- orangered: [255, 69, 0],
116
- orchid: [218, 112, 214],
117
- palegoldenrod: [238, 232, 170],
118
- palegreen: [152, 251, 152],
119
- paleturquoise: [175, 238, 238],
120
- palevioletred: [219, 112, 147],
121
- papayawhip: [255, 239, 213],
122
- peachpuff: [255, 218, 185],
123
- peru: [205, 133, 63],
124
- pink: [255, 192, 203],
125
- plum: [221, 160, 221],
126
- powderblue: [176, 224, 230],
127
- purple: [128, 0, 128],
128
- rebeccapurple: [102, 51, 153],
129
- red: [255, 0, 0],
130
- rosybrown: [188, 143, 143],
131
- royalblue: [65, 105, 225],
132
- saddlebrown: [139, 69, 19],
133
- salmon: [250, 128, 114],
134
- sandybrown: [244, 164, 96],
135
- seagreen: [46, 139, 87],
136
- seashell: [255, 245, 238],
137
- sienna: [160, 82, 45],
138
- silver: [192, 192, 192],
139
- skyblue: [135, 206, 235],
140
- slateblue: [106, 90, 205],
141
- slategray: [112, 128, 144],
142
- slategrey: [112, 128, 144],
143
- snow: [255, 250, 250],
144
- springgreen: [0, 255, 127],
145
- steelblue: [70, 130, 180],
146
- tan: [210, 180, 140],
147
- teal: [0, 128, 128],
148
- thistle: [216, 191, 216],
149
- tomato: [255, 99, 71],
150
- turquoise: [64, 224, 208],
151
- violet: [238, 130, 238],
152
- wheat: [245, 222, 179],
153
- white: [255, 255, 255],
154
- whitesmoke: [245, 245, 245],
155
- yellow: [255, 255, 0],
156
- yellowgreen: [154, 205, 50],
157
- };
@@ -1,8 +0,0 @@
1
- import { IColorChannel } from "../interfaces/IColorChannel";
2
- /**
3
- * Calculates the HSP Color Mode from the RGBA channels
4
- * - If the calculation are wrong or the given parameter is undefined, the function will return a default for light colors
5
- * @param rgbaChannel the rgba channel object
6
- * @returns a HSP color number
7
- */
8
- export declare function calculateHSP(rgbaChannel: IColorChannel): number;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calculateHSP = void 0;
4
- const general_1 = require("../../general");
5
- const isEmpty_1 = require("../../general/mix/isEmpty");
6
- /**
7
- * Calculates the HSP Color Mode from the RGBA channels
8
- * - If the calculation are wrong or the given parameter is undefined, the function will return a default for light colors
9
- * @param rgbaChannel the rgba channel object
10
- * @returns a HSP color number
11
- */
12
- function calculateHSP(rgbaChannel) {
13
- if ((0, isEmpty_1.isEmpty)(rgbaChannel))
14
- return 255;
15
- const { r, g, b } = rgbaChannel;
16
- // HSP equation from http://alienryderflex.com/hsp.html
17
- const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
18
- return (0, general_1.isNaNV2)(hsp) ? 255 : hsp;
19
- }
20
- exports.calculateHSP = calculateHSP;
@@ -1,8 +0,0 @@
1
- import { IColorChannel } from "../interfaces/IColorChannel";
2
- /**
3
- * Gets the RGBA channels based on the given string Hexadecimal color
4
- * - If the given argument is undefined or invalid, the function will return a channel related to white color
5
- * @param color the Hexadecimal color
6
- * @returns the RGBA channels
7
- */
8
- export declare function getChannelsByHexadecimalColor(hexadecimal?: string): IColorChannel;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChannelsByHexadecimalColor = void 0;
4
- const CHANNEL_WHITE_COLOR_1 = require("../constants/CHANNEL_WHITE_COLOR");
5
- const getHexadecimalOpacity_1 = require("./getHexadecimalOpacity");
6
- const isHexadecimalColor_1 = require("./isHexadecimalColor");
7
- /**
8
- * Gets the RGBA channels based on the given string Hexadecimal color
9
- * - If the given argument is undefined or invalid, the function will return a channel related to white color
10
- * @param color the Hexadecimal color
11
- * @returns the RGBA channels
12
- */
13
- function getChannelsByHexadecimalColor(hexadecimal = "") {
14
- if (!(0, isHexadecimalColor_1.isHexadecimalColor)(hexadecimal))
15
- return CHANNEL_WHITE_COLOR_1.CHANNEL_WHITE_COLOR;
16
- const colorCode = +`0x${hexadecimal
17
- .slice(1)
18
- .replace(hexadecimal.length < 5 && /./g, "$&$&")}`;
19
- return {
20
- r: colorCode >> 16,
21
- g: (colorCode >> 8) & 255,
22
- b: colorCode & 255,
23
- a: (0, getHexadecimalOpacity_1.getHexadecimalOpacity)(hexadecimal),
24
- };
25
- }
26
- exports.getChannelsByHexadecimalColor = getChannelsByHexadecimalColor;
@@ -1,8 +0,0 @@
1
- import { IColorChannel } from "../interfaces/IColorChannel";
2
- /**
3
- * Gets the RGBA channels based on the given string name color
4
- * - If the given argument is undefined or invalid, the function will return a channel related to white color
5
- * @param color the name color
6
- * @returns the RGBA channels
7
- */
8
- export declare function getChannelsByNameColor(name?: string): IColorChannel;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChannelsByNameColor = void 0;
4
- const isEmpty_1 = require("../../general/mix/isEmpty");
5
- const CHANNEL_WHITE_COLOR_1 = require("../constants/CHANNEL_WHITE_COLOR");
6
- const COLOR_NAME_1 = require("../constants/COLOR_NAME");
7
- /**
8
- * Gets the RGBA channels based on the given string name color
9
- * - If the given argument is undefined or invalid, the function will return a channel related to white color
10
- * @param color the name color
11
- * @returns the RGBA channels
12
- */
13
- function getChannelsByNameColor(name = "") {
14
- const nameColorChannel = COLOR_NAME_1.COLOR_NAME[String(name).toLowerCase()];
15
- if ((0, isEmpty_1.isEmpty)(nameColorChannel) ||
16
- !Array.isArray(nameColorChannel) ||
17
- nameColorChannel.length !== 3)
18
- return CHANNEL_WHITE_COLOR_1.CHANNEL_WHITE_COLOR;
19
- return {
20
- r: nameColorChannel[0],
21
- g: nameColorChannel[1],
22
- b: nameColorChannel[2],
23
- a: 1,
24
- };
25
- }
26
- exports.getChannelsByNameColor = getChannelsByNameColor;
@@ -1,8 +0,0 @@
1
- import { IColorChannel } from "../interfaces/IColorChannel";
2
- /**
3
- * Gets the RGBA channels based on the given string RGBA color
4
- * - If the given argument is undefined or invalid, the function will return a channel related to white color
5
- * @param color the RGBA color
6
- * @returns the RGBA channels
7
- */
8
- export declare function getChannelsByRgbaColor(rgba?: string): IColorChannel;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChannelsByRgbaColor = void 0;
4
- const CHANNEL_WHITE_COLOR_1 = require("../constants/CHANNEL_WHITE_COLOR");
5
- const RGBA_REGULAR_EXPRESION_1 = require("../constants/RGBA_REGULAR_EXPRESION");
6
- const getRgbaOpacity_1 = require("./getRgbaOpacity");
7
- const isRGBAColor_1 = require("./isRGBAColor");
8
- /**
9
- * Gets the RGBA channels based on the given string RGBA color
10
- * - If the given argument is undefined or invalid, the function will return a channel related to white color
11
- * @param color the RGBA color
12
- * @returns the RGBA channels
13
- */
14
- function getChannelsByRgbaColor(rgba = "") {
15
- if (!(0, isRGBAColor_1.isRGBAColor)(rgba))
16
- return CHANNEL_WHITE_COLOR_1.CHANNEL_WHITE_COLOR;
17
- const colors = rgba.toLowerCase().match(RGBA_REGULAR_EXPRESION_1.RGBA_REGULAR_EXPRESSION);
18
- return {
19
- r: Number(colors[1]),
20
- g: Number(colors[2]),
21
- b: Number(colors[3]),
22
- a: (0, getRgbaOpacity_1.getRgbaOpacity)(rgba),
23
- };
24
- }
25
- exports.getChannelsByRgbaColor = getChannelsByRgbaColor;