@996-design/996-fast-color 1.0.0

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.
@@ -0,0 +1,151 @@
1
+ // 36 Hex to reduce the size of the file
2
+ export default {
3
+ aliceblue: '9ehhb',
4
+ antiquewhite: '9sgk7',
5
+ aqua: '1ekf',
6
+ aquamarine: '4zsno',
7
+ azure: '9eiv3',
8
+ beige: '9lhp8',
9
+ bisque: '9zg04',
10
+ black: '0',
11
+ blanchedalmond: '9zhe5',
12
+ blue: '73',
13
+ blueviolet: '5e31e',
14
+ brown: '6g016',
15
+ burlywood: '8ouiv',
16
+ cadetblue: '3qba8',
17
+ chartreuse: '4zshs',
18
+ chocolate: '87k0u',
19
+ coral: '9yvyo',
20
+ cornflowerblue: '3xael',
21
+ cornsilk: '9zjz0',
22
+ crimson: '8l4xo',
23
+ cyan: '1ekf',
24
+ darkblue: '3v',
25
+ darkcyan: 'rkb',
26
+ darkgoldenrod: '776yz',
27
+ darkgray: '6mbhl',
28
+ darkgreen: 'jr4',
29
+ darkgrey: '6mbhl',
30
+ darkkhaki: '7ehkb',
31
+ darkmagenta: '5f91n',
32
+ darkolivegreen: '3bzfz',
33
+ darkorange: '9yygw',
34
+ darkorchid: '5z6x8',
35
+ darkred: '5f8xs',
36
+ darksalmon: '9441m',
37
+ darkseagreen: '5lwgf',
38
+ darkslateblue: '2th1n',
39
+ darkslategray: '1ugcv',
40
+ darkslategrey: '1ugcv',
41
+ darkturquoise: '14up',
42
+ darkviolet: '5rw7n',
43
+ deeppink: '9yavn',
44
+ deepskyblue: '11xb',
45
+ dimgray: '442g9',
46
+ dimgrey: '442g9',
47
+ dodgerblue: '16xof',
48
+ firebrick: '6y7tu',
49
+ floralwhite: '9zkds',
50
+ forestgreen: '1cisi',
51
+ fuchsia: '9y70f',
52
+ gainsboro: '8m8kc',
53
+ ghostwhite: '9pq0v',
54
+ goldenrod: '8j4f4',
55
+ gold: '9zda8',
56
+ gray: '50i2o',
57
+ green: 'pa8',
58
+ greenyellow: '6senj',
59
+ grey: '50i2o',
60
+ honeydew: '9eiuo',
61
+ hotpink: '9yrp0',
62
+ indianred: '80gnw',
63
+ indigo: '2xcoy',
64
+ ivory: '9zldc',
65
+ khaki: '9edu4',
66
+ lavenderblush: '9ziet',
67
+ lavender: '90c8q',
68
+ lawngreen: '4vk74',
69
+ lemonchiffon: '9zkct',
70
+ lightblue: '6s73a',
71
+ lightcoral: '9dtog',
72
+ lightcyan: '8s1rz',
73
+ lightgoldenrodyellow: '9sjiq',
74
+ lightgray: '89jo3',
75
+ lightgreen: '5nkwg',
76
+ lightgrey: '89jo3',
77
+ lightpink: '9z6wx',
78
+ lightsalmon: '9z2ii',
79
+ lightseagreen: '19xgq',
80
+ lightskyblue: '5arju',
81
+ lightslategray: '4nwk9',
82
+ lightslategrey: '4nwk9',
83
+ lightsteelblue: '6wau6',
84
+ lightyellow: '9zlcw',
85
+ lime: '1edc',
86
+ limegreen: '1zcxe',
87
+ linen: '9shk6',
88
+ magenta: '9y70f',
89
+ maroon: '4zsow',
90
+ mediumaquamarine: '40eju',
91
+ mediumblue: '5p',
92
+ mediumorchid: '79qkz',
93
+ mediumpurple: '5r3rv',
94
+ mediumseagreen: '2d9ip',
95
+ mediumslateblue: '4tcku',
96
+ mediumspringgreen: '1di2',
97
+ mediumturquoise: '2uabw',
98
+ mediumvioletred: '7rn9h',
99
+ midnightblue: 'z980',
100
+ mintcream: '9ljp6',
101
+ mistyrose: '9zg0x',
102
+ moccasin: '9zfzp',
103
+ navajowhite: '9zest',
104
+ navy: '3k',
105
+ oldlace: '9wq92',
106
+ olive: '50hz4',
107
+ olivedrab: '472ub',
108
+ orange: '9z3eo',
109
+ orangered: '9ykg0',
110
+ orchid: '8iu3a',
111
+ palegoldenrod: '9bl4a',
112
+ palegreen: '5yw0o',
113
+ paleturquoise: '6v4ku',
114
+ palevioletred: '8k8lv',
115
+ papayawhip: '9zi6t',
116
+ peachpuff: '9ze0p',
117
+ peru: '80oqn',
118
+ pink: '9z8wb',
119
+ plum: '8nba5',
120
+ powderblue: '6wgdi',
121
+ purple: '4zssg',
122
+ rebeccapurple: '3zk49',
123
+ red: '9y6tc',
124
+ rosybrown: '7cv4f',
125
+ royalblue: '2jvtt',
126
+ saddlebrown: '5fmkz',
127
+ salmon: '9rvci',
128
+ sandybrown: '9jn1c',
129
+ seagreen: '1tdnb',
130
+ seashell: '9zje6',
131
+ sienna: '6973h',
132
+ silver: '7ir40',
133
+ skyblue: '5arjf',
134
+ slateblue: '45e4t',
135
+ slategray: '4e100',
136
+ slategrey: '4e100',
137
+ snow: '9zke2',
138
+ springgreen: '1egv',
139
+ steelblue: '2r1kk',
140
+ tan: '87yx8',
141
+ teal: 'pds',
142
+ thistle: '8ggk8',
143
+ tomato: '9yqfb',
144
+ turquoise: '2j4r4',
145
+ violet: '9b10u',
146
+ wheat: '9ld4j',
147
+ white: '9zldr',
148
+ whitesmoke: '9lhpx',
149
+ yellow: '9zl6o',
150
+ yellowgreen: '61fzm'
151
+ };
package/es/types.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ export interface RGB {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ a: number;
6
+ }
7
+ export interface HSL {
8
+ h: number;
9
+ s: number;
10
+ l: number;
11
+ a: number;
12
+ }
13
+ export interface HSV {
14
+ h: number;
15
+ s: number;
16
+ v: number;
17
+ a: number;
18
+ }
19
+ export type OptionalA<T extends {
20
+ a: number;
21
+ }> = Omit<T, 'a'> & {
22
+ a?: number;
23
+ };
24
+ export type ColorInput = string | OptionalA<RGB> | OptionalA<HSL> | OptionalA<HSV>;
package/es/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,100 @@
1
+ import type { ColorInput, HSL, HSV, RGB } from './types';
2
+ export declare class FastColor {
3
+ /**
4
+ * All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
5
+ */
6
+ isValid: boolean;
7
+ /**
8
+ * Red, R in RGB
9
+ */
10
+ r: number;
11
+ /**
12
+ * Green, G in RGB
13
+ */
14
+ g: number;
15
+ /**
16
+ * Blue, B in RGB
17
+ */
18
+ b: number;
19
+ /**
20
+ * Alpha/Opacity, A in RGBA/HSLA
21
+ */
22
+ a: number;
23
+ private _h?;
24
+ private _hsl_s?;
25
+ private _hsv_s?;
26
+ private _l?;
27
+ private _v?;
28
+ private _max?;
29
+ private _min?;
30
+ private _brightness?;
31
+ constructor(input: ColorInput);
32
+ setR(value: number): this;
33
+ setG(value: number): this;
34
+ setB(value: number): this;
35
+ setA(value: number): this;
36
+ setHue(value: number): this;
37
+ /**
38
+ * Returns the perceived luminance of a color, from 0-1.
39
+ * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
40
+ */
41
+ getLuminance(): number;
42
+ getHue(): number;
43
+ /**
44
+ * @deprecated should use getHSVSaturation or getHSLSaturation instead
45
+ */
46
+ getSaturation(): number;
47
+ getHSVSaturation(): number;
48
+ getHSLSaturation(): number;
49
+ getLightness(): number;
50
+ getValue(): number;
51
+ /**
52
+ * Returns the perceived brightness of the color, from 0-255.
53
+ * Note: this is not the b of HSB
54
+ * @see http://www.w3.org/TR/AERT#color-contrast
55
+ */
56
+ getBrightness(): number;
57
+ darken(amount?: number): this;
58
+ lighten(amount?: number): this;
59
+ /**
60
+ * Mix the current color a given amount with another color, from 0 to 100.
61
+ * 0 means no mixing (return current color).
62
+ */
63
+ mix(input: ColorInput, amount?: number): this;
64
+ /**
65
+ * Mix the color with pure white, from 0 to 100.
66
+ * Providing 0 will do nothing, providing 100 will always return white.
67
+ */
68
+ tint(amount?: number): this;
69
+ /**
70
+ * Mix the color with pure black, from 0 to 100.
71
+ * Providing 0 will do nothing, providing 100 will always return black.
72
+ */
73
+ shade(amount?: number): this;
74
+ onBackground(background: ColorInput): this;
75
+ isDark(): boolean;
76
+ isLight(): boolean;
77
+ equals(other: FastColor): boolean;
78
+ clone(): this;
79
+ toHexString(): string;
80
+ /** CSS support color pattern */
81
+ toHsl(): HSL;
82
+ /** CSS support color pattern */
83
+ toHslString(): string;
84
+ /** Same as toHsb */
85
+ toHsv(): HSV;
86
+ toRgb(): RGB;
87
+ toRgbString(): string;
88
+ toString(): string;
89
+ /** Return a new FastColor object with one channel changed */
90
+ private _sc;
91
+ private _c;
92
+ private getMax;
93
+ private getMin;
94
+ private fromHexString;
95
+ private fromHsl;
96
+ private fromHsv;
97
+ private fromHsvString;
98
+ private fromHslString;
99
+ private fromRgbString;
100
+ }