@trackunit/ui-design-tokens 0.0.63 → 0.0.65
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/index.cjs
CHANGED
|
@@ -25,10 +25,15 @@ const DEFAULT_CHART_COLORS = [
|
|
|
25
25
|
"#5E5CE6",
|
|
26
26
|
"#2066FF",
|
|
27
27
|
"#FF9500",
|
|
28
|
+
"#E2E8F0",
|
|
28
29
|
];
|
|
30
|
+
/**
|
|
31
|
+
* Re-orders the default chart colors to make the first ones more visually different.
|
|
32
|
+
*/
|
|
29
33
|
const getReorderedChartColors = () => [
|
|
30
|
-
// re-ordered to make the first ones more visually different
|
|
31
34
|
DEFAULT_CHART_COLORS[0],
|
|
35
|
+
DEFAULT_CHART_COLORS[22],
|
|
36
|
+
DEFAULT_CHART_COLORS[1],
|
|
32
37
|
DEFAULT_CHART_COLORS[4],
|
|
33
38
|
DEFAULT_CHART_COLORS[7],
|
|
34
39
|
DEFAULT_CHART_COLORS[9],
|
|
@@ -37,7 +42,6 @@ const getReorderedChartColors = () => [
|
|
|
37
42
|
DEFAULT_CHART_COLORS[6],
|
|
38
43
|
DEFAULT_CHART_COLORS[8],
|
|
39
44
|
DEFAULT_CHART_COLORS[10],
|
|
40
|
-
DEFAULT_CHART_COLORS[1],
|
|
41
45
|
DEFAULT_CHART_COLORS[11],
|
|
42
46
|
DEFAULT_CHART_COLORS[3],
|
|
43
47
|
DEFAULT_CHART_COLORS[2],
|
|
@@ -52,8 +56,8 @@ const getReorderedChartColors = () => [
|
|
|
52
56
|
* This allows us to modify them with opacity values and more.
|
|
53
57
|
*
|
|
54
58
|
* @param variable CSS custom property for color
|
|
55
|
-
* @returns Full css for using the color
|
|
56
59
|
* @example "--color-primart-400" --> "rgb(var(--color-primary-400) / var(--tw-bg-opacity)))"
|
|
60
|
+
* @returns {string} Full css for using the color
|
|
57
61
|
*/
|
|
58
62
|
function colorVariableToCss(variable) {
|
|
59
63
|
return `rgb(var(${variable}) / var(--tw-bg-opacity))`;
|
|
@@ -79,7 +83,7 @@ function rgbToHex(r, g, b) {
|
|
|
79
83
|
* Example: color("PRIMARY", 500, "HEX") -> #3b82f6
|
|
80
84
|
*
|
|
81
85
|
* @param variable A color from the `colors` object of the Theme
|
|
82
|
-
* @returns HEX color
|
|
86
|
+
* @returns {string} HEX color
|
|
83
87
|
*/
|
|
84
88
|
const getHEX = (variable) => {
|
|
85
89
|
var _a, _b;
|
|
@@ -511,6 +515,15 @@ const themeColors = {
|
|
|
511
515
|
};
|
|
512
516
|
|
|
513
517
|
const outputOptions = ["HEX", "CSS"];
|
|
518
|
+
/**
|
|
519
|
+
*
|
|
520
|
+
Returns the color value in CSS or HEX format for a given theme color and variant.
|
|
521
|
+
*
|
|
522
|
+
@param ColorKey - A valid theme color name from the available ThemeColorKeys.
|
|
523
|
+
@param {unknown} [arg2] - An optional argument that can be either an OutputOptions or a variant value.
|
|
524
|
+
@param {unknown} [arg3] - An optional argument that can be either an OutputOptions or a variant value.
|
|
525
|
+
@returns {string} - Returns a string containing the color value in CSS or HEX format for the provided arguments.
|
|
526
|
+
*/
|
|
514
527
|
function color(ColorKey, arg2, arg3) {
|
|
515
528
|
var _a, _b;
|
|
516
529
|
const colorName = themeColors[ColorKey].name;
|
package/index.js
CHANGED
|
@@ -21,10 +21,15 @@ const DEFAULT_CHART_COLORS = [
|
|
|
21
21
|
"#5E5CE6",
|
|
22
22
|
"#2066FF",
|
|
23
23
|
"#FF9500",
|
|
24
|
+
"#E2E8F0",
|
|
24
25
|
];
|
|
26
|
+
/**
|
|
27
|
+
* Re-orders the default chart colors to make the first ones more visually different.
|
|
28
|
+
*/
|
|
25
29
|
const getReorderedChartColors = () => [
|
|
26
|
-
// re-ordered to make the first ones more visually different
|
|
27
30
|
DEFAULT_CHART_COLORS[0],
|
|
31
|
+
DEFAULT_CHART_COLORS[22],
|
|
32
|
+
DEFAULT_CHART_COLORS[1],
|
|
28
33
|
DEFAULT_CHART_COLORS[4],
|
|
29
34
|
DEFAULT_CHART_COLORS[7],
|
|
30
35
|
DEFAULT_CHART_COLORS[9],
|
|
@@ -33,7 +38,6 @@ const getReorderedChartColors = () => [
|
|
|
33
38
|
DEFAULT_CHART_COLORS[6],
|
|
34
39
|
DEFAULT_CHART_COLORS[8],
|
|
35
40
|
DEFAULT_CHART_COLORS[10],
|
|
36
|
-
DEFAULT_CHART_COLORS[1],
|
|
37
41
|
DEFAULT_CHART_COLORS[11],
|
|
38
42
|
DEFAULT_CHART_COLORS[3],
|
|
39
43
|
DEFAULT_CHART_COLORS[2],
|
|
@@ -48,8 +52,8 @@ const getReorderedChartColors = () => [
|
|
|
48
52
|
* This allows us to modify them with opacity values and more.
|
|
49
53
|
*
|
|
50
54
|
* @param variable CSS custom property for color
|
|
51
|
-
* @returns Full css for using the color
|
|
52
55
|
* @example "--color-primart-400" --> "rgb(var(--color-primary-400) / var(--tw-bg-opacity)))"
|
|
56
|
+
* @returns {string} Full css for using the color
|
|
53
57
|
*/
|
|
54
58
|
function colorVariableToCss(variable) {
|
|
55
59
|
return `rgb(var(${variable}) / var(--tw-bg-opacity))`;
|
|
@@ -75,7 +79,7 @@ function rgbToHex(r, g, b) {
|
|
|
75
79
|
* Example: color("PRIMARY", 500, "HEX") -> #3b82f6
|
|
76
80
|
*
|
|
77
81
|
* @param variable A color from the `colors` object of the Theme
|
|
78
|
-
* @returns HEX color
|
|
82
|
+
* @returns {string} HEX color
|
|
79
83
|
*/
|
|
80
84
|
const getHEX = (variable) => {
|
|
81
85
|
var _a, _b;
|
|
@@ -507,6 +511,15 @@ const themeColors = {
|
|
|
507
511
|
};
|
|
508
512
|
|
|
509
513
|
const outputOptions = ["HEX", "CSS"];
|
|
514
|
+
/**
|
|
515
|
+
*
|
|
516
|
+
Returns the color value in CSS or HEX format for a given theme color and variant.
|
|
517
|
+
*
|
|
518
|
+
@param ColorKey - A valid theme color name from the available ThemeColorKeys.
|
|
519
|
+
@param {unknown} [arg2] - An optional argument that can be either an OutputOptions or a variant value.
|
|
520
|
+
@param {unknown} [arg3] - An optional argument that can be either an OutputOptions or a variant value.
|
|
521
|
+
@returns {string} - Returns a string containing the color value in CSS or HEX format for the provided arguments.
|
|
522
|
+
*/
|
|
510
523
|
function color(ColorKey, arg2, arg3) {
|
|
511
524
|
var _a, _b;
|
|
512
525
|
const colorName = themeColors[ColorKey].name;
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This allows us to modify them with opacity values and more.
|
|
7
7
|
*
|
|
8
8
|
* @param variable CSS custom property for color
|
|
9
|
-
* @returns Full css for using the color
|
|
10
9
|
* @example "--color-primart-400" --> "rgb(var(--color-primary-400) / var(--tw-bg-opacity)))"
|
|
10
|
+
* @returns {string} Full css for using the color
|
|
11
11
|
*/
|
|
12
12
|
export declare function colorVariableToCss(variable: string): string;
|