hue.gl 0.0.9 → 0.0.11
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/js/color/ColorPicker.d.ts +11 -0
- package/js/color/ColorPicker.js +53 -0
- package/js/color/ColorScheme.d.ts +23 -0
- package/js/color/ColorScheme.js +90 -0
- package/js/color/ColorSwatch.d.ts +54 -0
- package/js/color/ColorSwatch.js +258 -0
- package/js/color/index.d.ts +3 -0
- package/js/color/index.js +19 -0
- package/js/config/hue.config.d.ts +11 -0
- package/js/config/hue.config.js +28 -0
- package/js/config/hue.names.d.ts +27 -0
- package/js/config/hue.names.js +44 -0
- package/js/config/index.d.ts +2 -0
- package/js/config/index.js +17 -0
- package/js/constants/hue_hcl.d.ts +227 -0
- package/js/constants/hue_hcl.js +299 -0
- package/js/constants/hue_hex.d.ts +227 -0
- package/js/constants/hue_hex.js +299 -0
- package/js/constants/hue_rgb.d.ts +227 -0
- package/js/constants/hue_rgb.js +299 -0
- package/js/constants/index.d.ts +3 -0
- package/js/constants/index.js +19 -0
- package/js/hue.gl.min.js +1 -1
- package/js/index.d.ts +3 -1
- package/js/index.js +22 -1
- package/js/util.d.ts +11 -0
- package/js/util.js +47 -0
- package/package.json +1 -1
- package/py/hue.gl.py +1 -1
- package/rcpx/hue.gl.rcpx +1 -1
- package/scss/hue/_hue.gl-hcl-map.scss +1 -1
- package/scss/hue/_hue.gl-hcl-var.scss +1 -1
- package/scss/hue/_hue.gl-hex-map.scss +1 -1
- package/scss/hue/_hue.gl-hex-var.scss +1 -1
- package/scss/hue/_hue.gl-rgb-map.scss +1 -1
- package/scss/hue/_hue.gl-rgb-var.scss +1 -1
- package/scss/utils/_base.scss +13 -0
- package/scss/utils/_blend.scss +84 -1
- package/scss/utils/_contrast.scss +62 -2
- package/scss/utils/_filter.scss +37 -0
- package/scss/utils/_helpers.scss +31 -0
- package/scss/utils/_pattern.scss +40 -0
- package/scss/utils/_scheme.scss +136 -4
- package/scss/utils/_variants.scss +129 -6
- package/scss/utils/utils.scss +1 -0
- package/styl/hue.gl.styl +1 -1
- package/tex/hue.gl.tex +1 -1
- package/ts/color/ColorPicker.ts +75 -0
- package/ts/color/ColorScheme.ts +126 -0
- package/ts/color/ColorSwatch.ts +327 -0
- package/ts/color/index.ts +18 -0
- package/ts/{hue.gl.d.ts → config/hue.config.ts} +17 -6
- package/ts/config/hue.names.ts +48 -0
- package/ts/config/index.ts +18 -0
- package/ts/constants/hue_hcl.ts +356 -0
- package/ts/constants/hue_hex.ts +356 -0
- package/ts/constants/hue_rgb.ts +356 -0
- package/ts/constants/index.ts +18 -0
- package/ts/index.ts +19 -2
- package/ts/util.ts +52 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type ColorEnum = 'RGB' | 'HSL' | 'HCL' | 'HEX';
|
|
2
|
+
export declare class ColorPicker {
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves a color value by its enum key.
|
|
5
|
+
* @param colorEnum The enum type ('RGB' or 'HSL') to pick the color from.
|
|
6
|
+
* @param colorKey The key of the color in the specified enum.
|
|
7
|
+
* @returns The color value or null if the key does not exist in the specified enum.
|
|
8
|
+
*/
|
|
9
|
+
static get(colorEnum: ColorEnum, colorKey: string): string | null;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// script/class/class/DirectoryCleaner.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ColorPicker = void 0;
|
|
5
|
+
// Copyright 2023 Scape Agency BV
|
|
6
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
// you may not use this file except in compliance with the License.
|
|
8
|
+
// You may obtain a copy of the License at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Import
|
|
17
|
+
// ============================================================================
|
|
18
|
+
var constants_1 = require("../constants");
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Classes
|
|
21
|
+
// ============================================================================
|
|
22
|
+
class ColorPicker {
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves a color value by its enum key.
|
|
25
|
+
* @param colorEnum The enum type ('RGB' or 'HSL') to pick the color from.
|
|
26
|
+
* @param colorKey The key of the color in the specified enum.
|
|
27
|
+
* @returns The color value or null if the key does not exist in the specified enum.
|
|
28
|
+
*/
|
|
29
|
+
static get(colorEnum, colorKey) {
|
|
30
|
+
let color;
|
|
31
|
+
switch (colorEnum) {
|
|
32
|
+
case 'RGB':
|
|
33
|
+
// color = hue_rgb[colorKey as keyof typeof hue_rgb];
|
|
34
|
+
return constants_1.hue_rgb[colorKey] || null;
|
|
35
|
+
// break;
|
|
36
|
+
case 'HCL':
|
|
37
|
+
// color = hue_hcl[colorKey as keyof typeof hue_hcl];
|
|
38
|
+
return constants_1.hue_hcl[colorKey] || null;
|
|
39
|
+
// break;
|
|
40
|
+
case 'HEX':
|
|
41
|
+
// color = hue_hex[colorKey as keyof typeof hue_hex];
|
|
42
|
+
return constants_1.hue_hex[colorKey] || null;
|
|
43
|
+
// break;
|
|
44
|
+
default:
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
// return color || null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ColorPicker = ColorPicker;
|
|
51
|
+
// Usage examples
|
|
52
|
+
// const specificRGBColor = ColorPicker.getColor('RGB', 'N0001'); // Should return "rgb(0, 0, 90)" or similar
|
|
53
|
+
// console.log(specificRGBColor); // Outputs: rgb(0, 0, 90) or similar
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ColorSwatch } from './ColorSwatch.js';
|
|
2
|
+
type ColorSchemeConfig = {
|
|
3
|
+
prefix?: string;
|
|
4
|
+
h_step?: number;
|
|
5
|
+
p_count?: number;
|
|
6
|
+
l_l_min?: number;
|
|
7
|
+
l_l_step?: number;
|
|
8
|
+
d_l_step?: number;
|
|
9
|
+
l_c_min?: number;
|
|
10
|
+
l_c_step?: number;
|
|
11
|
+
d_c_step?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare class ColorScheme {
|
|
14
|
+
config: ColorSchemeConfig | any;
|
|
15
|
+
names: any;
|
|
16
|
+
colorList: ColorSwatch[];
|
|
17
|
+
colorDict: Record<string, Record<string, ColorSwatch>>;
|
|
18
|
+
constructor(config: ColorSchemeConfig, names: any);
|
|
19
|
+
private initializeColors;
|
|
20
|
+
getColorList(): ColorSwatch[];
|
|
21
|
+
getColorDict(): Record<string, Record<string, ColorSwatch>>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// script/class/class/DirectoryCleaner.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ColorScheme = void 0;
|
|
5
|
+
// Copyright 2023 Scape Agency BV
|
|
6
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
// you may not use this file except in compliance with the License.
|
|
8
|
+
// You may obtain a copy of the License at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Import
|
|
17
|
+
// ============================================================================
|
|
18
|
+
var ColorSwatch_js_1 = require("./ColorSwatch.js");
|
|
19
|
+
var util_js_1 = require("../util.js");
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Classes
|
|
22
|
+
// ============================================================================
|
|
23
|
+
class ColorScheme {
|
|
24
|
+
constructor(config, names) {
|
|
25
|
+
// Initialize colorList and other properties based on config
|
|
26
|
+
this.config = config;
|
|
27
|
+
this.names = names;
|
|
28
|
+
this.colorList = [];
|
|
29
|
+
this.colorDict = {};
|
|
30
|
+
this.initializeColors();
|
|
31
|
+
}
|
|
32
|
+
initializeColors() {
|
|
33
|
+
// Logic to initialize colorList based on the provided configuration
|
|
34
|
+
const l_count = Math.ceil(this.config.p_count / 2);
|
|
35
|
+
const d_count = Math.floor(this.config.p_count / 2);
|
|
36
|
+
const d_l_min = this.config.l_l_min + (this.config.l_l_step * (l_count - 1));
|
|
37
|
+
const d_c_min = this.config.l_c_min + (this.config.l_c_step * (l_count - 1));
|
|
38
|
+
// Create LC lists
|
|
39
|
+
// --------------------------------------------------------------------
|
|
40
|
+
// const l_list = [0];
|
|
41
|
+
// const c_list = [0];
|
|
42
|
+
const l_list = [];
|
|
43
|
+
const c_list = [];
|
|
44
|
+
for (let i = 0; i < this.config.p_count; i++) {
|
|
45
|
+
let l_cur = this.config.l_l_min + this.config.l_l_step + i * this.config.l_l_step - 2 * i;
|
|
46
|
+
l_list.push(l_cur);
|
|
47
|
+
}
|
|
48
|
+
;
|
|
49
|
+
for (let i = 0; i < l_count; i++) {
|
|
50
|
+
let c_cur = this.config.l_c_min + i * this.config.l_c_step;
|
|
51
|
+
c_list.push(c_cur);
|
|
52
|
+
}
|
|
53
|
+
;
|
|
54
|
+
for (let i = 0; i < d_count; i++) {
|
|
55
|
+
let c_cur = d_c_min + this.config.d_c_step + i * this.config.d_c_step;
|
|
56
|
+
c_list.push(c_cur);
|
|
57
|
+
}
|
|
58
|
+
;
|
|
59
|
+
// Create hue.gl
|
|
60
|
+
// --------------------------------------------------------------------
|
|
61
|
+
// for (let h = this.config.h_step; h <= 360; h += this.config.h_step) {
|
|
62
|
+
for (let h = 0; h <= 360; h += this.config.h_step) {
|
|
63
|
+
let h_group = {};
|
|
64
|
+
// let h_group_name = h.toString();
|
|
65
|
+
let h_group_name = this.names[h];
|
|
66
|
+
;
|
|
67
|
+
for (let i = 0; i < this.config.p_count; i++) {
|
|
68
|
+
let l_cur = l_list[i];
|
|
69
|
+
let c_cur = c_list[i];
|
|
70
|
+
if (h == 0) {
|
|
71
|
+
c_cur = 0;
|
|
72
|
+
}
|
|
73
|
+
;
|
|
74
|
+
let name = this.config.prefix + (0, util_js_1.pad)(h.toString(), 3, "0") + (i + 1).toString();
|
|
75
|
+
let color = new ColorSwatch_js_1.ColorSwatch(h, c_cur, l_cur, name);
|
|
76
|
+
this.colorList.push(color);
|
|
77
|
+
h_group[name] = color;
|
|
78
|
+
}
|
|
79
|
+
;
|
|
80
|
+
this.colorDict[h_group_name] = h_group;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
getColorList() {
|
|
84
|
+
return this.colorList;
|
|
85
|
+
}
|
|
86
|
+
getColorDict() {
|
|
87
|
+
return this.colorDict;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.ColorScheme = ColorScheme;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Color from 'colorjs.io';
|
|
2
|
+
export declare class ColorSwatch {
|
|
3
|
+
name?: string;
|
|
4
|
+
h: number;
|
|
5
|
+
c: number;
|
|
6
|
+
l: number;
|
|
7
|
+
model: Color;
|
|
8
|
+
constructor(h: number, c: number, l: number, name?: string);
|
|
9
|
+
setHCL(h: number, c: number, l: number): void;
|
|
10
|
+
checkGamut(color_constant: Color): boolean;
|
|
11
|
+
getName(): string | undefined;
|
|
12
|
+
getRGB(): [number, number, number];
|
|
13
|
+
a98rgb(): import("colorjs.io/types/src/color.js").Coords;
|
|
14
|
+
a98rgb_linear(): import("colorjs.io/types/src/color.js").Coords;
|
|
15
|
+
acescg(): import("colorjs.io/types/src/color.js").Coords;
|
|
16
|
+
hsl(): import("colorjs.io/types/src/color.js").Coords;
|
|
17
|
+
hsv(): import("colorjs.io/types/src/color.js").Coords;
|
|
18
|
+
hwb(): import("colorjs.io/types/src/color.js").Coords;
|
|
19
|
+
ictcp(): import("colorjs.io/types/src/color.js").Coords;
|
|
20
|
+
jzczhz(): import("colorjs.io/types/src/color.js").Coords;
|
|
21
|
+
jzazbz(): import("colorjs.io/types/src/color.js").Coords;
|
|
22
|
+
lab(): import("colorjs.io/types/src/color.js").Coords;
|
|
23
|
+
lab_d65(): import("colorjs.io/types/src/color.js").Coords;
|
|
24
|
+
lch(): import("colorjs.io/types/src/color.js").Coords;
|
|
25
|
+
oklch(): import("colorjs.io/types/src/color.js").Coords;
|
|
26
|
+
oklab(): import("colorjs.io/types/src/color.js").Coords;
|
|
27
|
+
p3(): import("colorjs.io/types/src/color.js").Coords;
|
|
28
|
+
p3_linear(): import("colorjs.io/types/src/color.js").Coords;
|
|
29
|
+
prophoto(): import("colorjs.io/types/src/color.js").Coords;
|
|
30
|
+
prophoto_linear(): import("colorjs.io/types/src/color.js").Coords;
|
|
31
|
+
rec2020(): import("colorjs.io/types/src/color.js").Coords;
|
|
32
|
+
rec2020_linear(): import("colorjs.io/types/src/color.js").Coords;
|
|
33
|
+
rec2100hlg(): import("colorjs.io/types/src/color.js").Coords;
|
|
34
|
+
rec2100pq(): import("colorjs.io/types/src/color.js").Coords;
|
|
35
|
+
xyz_abs_d65(): import("colorjs.io/types/src/color.js").Coords;
|
|
36
|
+
xyz_d50(): import("colorjs.io/types/src/color.js").Coords;
|
|
37
|
+
xyz_d65(): import("colorjs.io/types/src/color.js").Coords;
|
|
38
|
+
xyz(): import("colorjs.io/types/src/color.js").Coords;
|
|
39
|
+
srgb(): Color;
|
|
40
|
+
srgb_linear(): import("colorjs.io/types/src/color.js").Coords;
|
|
41
|
+
hex(): string;
|
|
42
|
+
hcl(): {
|
|
43
|
+
h: number;
|
|
44
|
+
c: number;
|
|
45
|
+
l: number;
|
|
46
|
+
};
|
|
47
|
+
rgb(): {
|
|
48
|
+
r: number;
|
|
49
|
+
g: number;
|
|
50
|
+
b: number;
|
|
51
|
+
};
|
|
52
|
+
toString(): string;
|
|
53
|
+
toDict(): Record<string, any>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2023 Scape Agency BV
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ColorSwatch = void 0;
|
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
// you may not use this file except in compliance with the License.
|
|
10
|
+
// You may obtain a copy of the License at
|
|
11
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
// See the License for the specific language governing permissions and
|
|
16
|
+
// limitations under the License.
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Import
|
|
19
|
+
// ============================================================================
|
|
20
|
+
var colorjs_io_1 = __importDefault(require("colorjs.io"));
|
|
21
|
+
var util_js_1 = require("../util.js");
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Classes
|
|
24
|
+
// ============================================================================
|
|
25
|
+
class ColorSwatch {
|
|
26
|
+
constructor(h, c, l, name) {
|
|
27
|
+
this.h = 0; // Hue (0-360)
|
|
28
|
+
this.c = 0; // Chroma (0-100)
|
|
29
|
+
this.l = 0; // Luminance (0-100)
|
|
30
|
+
if (h < 0 || h > 360 || c < 0 || c > 100 || l < 0 || l > 100) {
|
|
31
|
+
throw new Error("Invalid HCL values");
|
|
32
|
+
}
|
|
33
|
+
this.h = h;
|
|
34
|
+
this.c = c;
|
|
35
|
+
this.l = l;
|
|
36
|
+
// this.setHCL(h, c, l);
|
|
37
|
+
this.name = name;
|
|
38
|
+
this.model = new colorjs_io_1.default("lch", [l, c, h]);
|
|
39
|
+
;
|
|
40
|
+
}
|
|
41
|
+
setHCL(h, c, l) {
|
|
42
|
+
if (h < 0 || h > 360 || c < 0 || c > 100 || l < 0 || l > 100) {
|
|
43
|
+
throw new Error("Invalid HCL values");
|
|
44
|
+
}
|
|
45
|
+
this.h = h;
|
|
46
|
+
this.c = c;
|
|
47
|
+
this.l = l;
|
|
48
|
+
}
|
|
49
|
+
/// Color Gamut Checks
|
|
50
|
+
checkGamut(color_constant) {
|
|
51
|
+
let lch_in_gamut = (color_constant.to("lch")).inGamut();
|
|
52
|
+
let srgb_in_gamut = (color_constant.to("srgb")).inGamut();
|
|
53
|
+
let argb_in_gamut = (color_constant.to("a98rgb")).inGamut();
|
|
54
|
+
// console.log(argb_in_gamut);
|
|
55
|
+
let in_gamut;
|
|
56
|
+
if (lch_in_gamut == false ||
|
|
57
|
+
srgb_in_gamut == false ||
|
|
58
|
+
argb_in_gamut == false) {
|
|
59
|
+
in_gamut = false;
|
|
60
|
+
// color_object = new Color("white");
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
in_gamut = true;
|
|
64
|
+
}
|
|
65
|
+
return in_gamut;
|
|
66
|
+
}
|
|
67
|
+
getName() {
|
|
68
|
+
return this.name;
|
|
69
|
+
}
|
|
70
|
+
// HCL(): [number, number, number] {
|
|
71
|
+
// return [this.h, this.c, this.l];
|
|
72
|
+
// }
|
|
73
|
+
getRGB() {
|
|
74
|
+
// const color_constant = new Color("lch", [l, c, h]);
|
|
75
|
+
// let color_object = color_constant
|
|
76
|
+
// Convert HCL to RGB here
|
|
77
|
+
// This is a non-trivial conversion and may require a detailed algorithm or library
|
|
78
|
+
// Placeholder for conversion logic
|
|
79
|
+
return [0, 0, 0]; // Replace with actual conversion logic
|
|
80
|
+
}
|
|
81
|
+
// Color Space Conversions
|
|
82
|
+
// ========================================================================
|
|
83
|
+
a98rgb() {
|
|
84
|
+
let color = this.model.to("a98rgb");
|
|
85
|
+
return color.coords;
|
|
86
|
+
}
|
|
87
|
+
a98rgb_linear() {
|
|
88
|
+
let color = this.model.to("a98rgb-linear");
|
|
89
|
+
return color.coords;
|
|
90
|
+
}
|
|
91
|
+
acescg() {
|
|
92
|
+
let color = this.model.to("acescg");
|
|
93
|
+
return color.coords;
|
|
94
|
+
}
|
|
95
|
+
hsl() {
|
|
96
|
+
let color = this.model.to("hsl");
|
|
97
|
+
return color.coords;
|
|
98
|
+
}
|
|
99
|
+
hsv() {
|
|
100
|
+
let color = this.model.to("hsv");
|
|
101
|
+
return color.coords;
|
|
102
|
+
}
|
|
103
|
+
hwb() {
|
|
104
|
+
let color = this.model.to("hwb");
|
|
105
|
+
return color.coords;
|
|
106
|
+
}
|
|
107
|
+
ictcp() {
|
|
108
|
+
let color = this.model.to("ictcp");
|
|
109
|
+
return color.coords;
|
|
110
|
+
}
|
|
111
|
+
jzczhz() {
|
|
112
|
+
let color = this.model.to("jzczhz");
|
|
113
|
+
return color.coords;
|
|
114
|
+
}
|
|
115
|
+
jzazbz() {
|
|
116
|
+
let color = this.model.to("jzazbz");
|
|
117
|
+
return color.coords;
|
|
118
|
+
}
|
|
119
|
+
lab() {
|
|
120
|
+
let color = this.model.to("lab");
|
|
121
|
+
return color.coords;
|
|
122
|
+
}
|
|
123
|
+
lab_d65() {
|
|
124
|
+
let color = this.model.to("lab-d65");
|
|
125
|
+
return color.coords;
|
|
126
|
+
}
|
|
127
|
+
lch() {
|
|
128
|
+
let color = this.model.to("lch");
|
|
129
|
+
return color.coords;
|
|
130
|
+
}
|
|
131
|
+
oklch() {
|
|
132
|
+
let color = this.model.to("oklch");
|
|
133
|
+
return color.coords;
|
|
134
|
+
}
|
|
135
|
+
oklab() {
|
|
136
|
+
let color = this.model.to("oklab");
|
|
137
|
+
return color.coords;
|
|
138
|
+
}
|
|
139
|
+
p3() {
|
|
140
|
+
let color = this.model.to("p3");
|
|
141
|
+
return color.coords;
|
|
142
|
+
}
|
|
143
|
+
p3_linear() {
|
|
144
|
+
let color = this.model.to("p3-linear");
|
|
145
|
+
return color.coords;
|
|
146
|
+
}
|
|
147
|
+
prophoto() {
|
|
148
|
+
let color = this.model.to("prophoto");
|
|
149
|
+
return color.coords;
|
|
150
|
+
}
|
|
151
|
+
prophoto_linear() {
|
|
152
|
+
let color = this.model.to("prophoto-linear");
|
|
153
|
+
return color.coords;
|
|
154
|
+
}
|
|
155
|
+
rec2020() {
|
|
156
|
+
let color = this.model.to("rec2020");
|
|
157
|
+
return color.coords;
|
|
158
|
+
}
|
|
159
|
+
rec2020_linear() {
|
|
160
|
+
let color = this.model.to("rec2020-linear");
|
|
161
|
+
return color.coords;
|
|
162
|
+
}
|
|
163
|
+
rec2100hlg() {
|
|
164
|
+
let color = this.model.to("rec2100hlg");
|
|
165
|
+
return color.coords;
|
|
166
|
+
}
|
|
167
|
+
rec2100pq() {
|
|
168
|
+
let color = this.model.to("rec2100pq");
|
|
169
|
+
return color.coords;
|
|
170
|
+
}
|
|
171
|
+
xyz_abs_d65() {
|
|
172
|
+
let color = this.model.to("xyz-abs-d65");
|
|
173
|
+
return color.coords;
|
|
174
|
+
}
|
|
175
|
+
xyz_d50() {
|
|
176
|
+
let color = this.model.to("xyz-d50");
|
|
177
|
+
return color.coords;
|
|
178
|
+
}
|
|
179
|
+
xyz_d65() {
|
|
180
|
+
let color = this.model.to("xyz-d65");
|
|
181
|
+
return color.coords;
|
|
182
|
+
}
|
|
183
|
+
xyz() {
|
|
184
|
+
let color = this.model.to("xyz");
|
|
185
|
+
return color.coords;
|
|
186
|
+
}
|
|
187
|
+
srgb() {
|
|
188
|
+
let color = this.model.to("srgb");
|
|
189
|
+
return color;
|
|
190
|
+
}
|
|
191
|
+
srgb_linear() {
|
|
192
|
+
let color = this.model.to("srgb-linear");
|
|
193
|
+
return color.coords;
|
|
194
|
+
}
|
|
195
|
+
hex() {
|
|
196
|
+
let color = this.srgb();
|
|
197
|
+
let hex = (0, util_js_1.convertRGBtoHex)(Math.round(color.coords[0] * 255), Math.round(color.coords[1] * 255), Math.round(color.coords[2] * 255));
|
|
198
|
+
// console.log(color.coords[0]);
|
|
199
|
+
return hex;
|
|
200
|
+
}
|
|
201
|
+
hcl() {
|
|
202
|
+
let hcl = {
|
|
203
|
+
"h": this.h,
|
|
204
|
+
"c": this.c,
|
|
205
|
+
"l": this.l
|
|
206
|
+
};
|
|
207
|
+
return hcl;
|
|
208
|
+
}
|
|
209
|
+
// rgb() {
|
|
210
|
+
// let color = this.srgb();
|
|
211
|
+
// let rgb = (
|
|
212
|
+
// Math.round(color.coords[0]*255),
|
|
213
|
+
// Math.round(color.coords[1]*255),
|
|
214
|
+
// Math.round(color.coords[2]*255)
|
|
215
|
+
// );
|
|
216
|
+
// return rgb;
|
|
217
|
+
// }
|
|
218
|
+
rgb() {
|
|
219
|
+
let color = this.srgb();
|
|
220
|
+
let rgb = {
|
|
221
|
+
"r": Math.round(color.coords[0] * 255),
|
|
222
|
+
"g": Math.round(color.coords[1] * 255),
|
|
223
|
+
"b": Math.round(color.coords[2] * 255)
|
|
224
|
+
};
|
|
225
|
+
return rgb;
|
|
226
|
+
}
|
|
227
|
+
// cmyk() {
|
|
228
|
+
// let color_srgb = this.srgb;
|
|
229
|
+
// let cmyk = rgb2cmyk(
|
|
230
|
+
// color_srgb[0],
|
|
231
|
+
// color_srgb[1],
|
|
232
|
+
// color_srgb[2],
|
|
233
|
+
// false
|
|
234
|
+
// );
|
|
235
|
+
// let color = this.model.to("srgb-linear");
|
|
236
|
+
// return color.coords;
|
|
237
|
+
// }
|
|
238
|
+
// // Color Strings
|
|
239
|
+
// // --------------------------------------------------------
|
|
240
|
+
// let color_css = color_object
|
|
241
|
+
// let color_string_rgb = color_srgb.toString({precision: 3, format: "rgb"});
|
|
242
|
+
// let color_string_rgba = color_srgb.toString({precision: 3, format: "rgba"});
|
|
243
|
+
// let color_string_hex = color_srgb.toString({precision: 3, format: "hex"});
|
|
244
|
+
// let color_string_color = color_srgb.toString({precision: 3, format: "color"});
|
|
245
|
+
toString() {
|
|
246
|
+
const [r, g, b] = this.getRGB();
|
|
247
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
248
|
+
}
|
|
249
|
+
toDict() {
|
|
250
|
+
return {
|
|
251
|
+
name: this.name,
|
|
252
|
+
hcl_h: this.h,
|
|
253
|
+
hcl_c: this.c,
|
|
254
|
+
hcl_l: this.l
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
exports.ColorSwatch = ColorSwatch;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2024 Scape Agency BV
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ColorPicker = exports.ColorSwatch = exports.ColorScheme = void 0;
|
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
// you may not use this file except in compliance with the License.
|
|
7
|
+
// You may obtain a copy of the License at
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
var ColorScheme_1 = require("./ColorScheme");
|
|
15
|
+
Object.defineProperty(exports, "ColorScheme", { enumerable: true, get: function () { return ColorScheme_1.ColorScheme; } });
|
|
16
|
+
var ColorSwatch_1 = require("./ColorSwatch");
|
|
17
|
+
Object.defineProperty(exports, "ColorSwatch", { enumerable: true, get: function () { return ColorSwatch_1.ColorSwatch; } });
|
|
18
|
+
var ColorPicker_1 = require("./ColorPicker");
|
|
19
|
+
Object.defineProperty(exports, "ColorPicker", { enumerable: true, get: function () { return ColorPicker_1.ColorPicker; } });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// hue/config/hue.config.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.hueConfig = void 0;
|
|
5
|
+
// Copyright 2023 Scape Agency BV
|
|
6
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
// you may not use this file except in compliance with the License.
|
|
8
|
+
// You may obtain a copy of the License at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Constants
|
|
17
|
+
// ============================================================================
|
|
18
|
+
exports.hueConfig = {
|
|
19
|
+
prefix: "N",
|
|
20
|
+
h_step: 15,
|
|
21
|
+
p_count: 9,
|
|
22
|
+
l_l_min: 96,
|
|
23
|
+
l_l_step: -6,
|
|
24
|
+
d_l_step: -6,
|
|
25
|
+
l_c_min: 12,
|
|
26
|
+
l_c_step: 6,
|
|
27
|
+
d_c_step: -6
|
|
28
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const hueNames: {
|
|
2
|
+
0: string;
|
|
3
|
+
15: string;
|
|
4
|
+
30: string;
|
|
5
|
+
45: string;
|
|
6
|
+
60: string;
|
|
7
|
+
75: string;
|
|
8
|
+
90: string;
|
|
9
|
+
105: string;
|
|
10
|
+
120: string;
|
|
11
|
+
135: string;
|
|
12
|
+
150: string;
|
|
13
|
+
165: string;
|
|
14
|
+
180: string;
|
|
15
|
+
195: string;
|
|
16
|
+
210: string;
|
|
17
|
+
225: string;
|
|
18
|
+
240: string;
|
|
19
|
+
255: string;
|
|
20
|
+
270: string;
|
|
21
|
+
285: string;
|
|
22
|
+
300: string;
|
|
23
|
+
315: string;
|
|
24
|
+
330: string;
|
|
25
|
+
345: string;
|
|
26
|
+
360: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// hue/config/hue.names.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.hueNames = void 0;
|
|
5
|
+
// Copyright 2023 Scape Agency BV
|
|
6
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
// you may not use this file except in compliance with the License.
|
|
8
|
+
// You may obtain a copy of the License at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Constants
|
|
17
|
+
// ============================================================================
|
|
18
|
+
exports.hueNames = {
|
|
19
|
+
0: "Grey",
|
|
20
|
+
15: "Salmon",
|
|
21
|
+
30: "Orange",
|
|
22
|
+
45: "Amber",
|
|
23
|
+
60: "Yellow", // Fixed
|
|
24
|
+
75: "Lime",
|
|
25
|
+
90: "Ecru",
|
|
26
|
+
105: "Olive",
|
|
27
|
+
120: "Green", // Fixed
|
|
28
|
+
135: "Forest",
|
|
29
|
+
150: "Jade",
|
|
30
|
+
165: "Mint",
|
|
31
|
+
180: "Cyan", // Fixed
|
|
32
|
+
195: "Teal",
|
|
33
|
+
210: "Capri",
|
|
34
|
+
225: "Sky",
|
|
35
|
+
240: "Blue", // Fixed
|
|
36
|
+
255: "Azure",
|
|
37
|
+
270: "Indigo",
|
|
38
|
+
285: "Violet",
|
|
39
|
+
300: "Magenta", // Fixed
|
|
40
|
+
315: "Purple",
|
|
41
|
+
330: "Rose",
|
|
42
|
+
345: "Pink",
|
|
43
|
+
360: "Red"
|
|
44
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2024 Scape Agency BV
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.hueNames = exports.hueConfig = void 0;
|
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
// you may not use this file except in compliance with the License.
|
|
7
|
+
// You may obtain a copy of the License at
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
var hue_config_1 = require("./hue.config");
|
|
15
|
+
Object.defineProperty(exports, "hueConfig", { enumerable: true, get: function () { return hue_config_1.hueConfig; } });
|
|
16
|
+
var hue_names_1 = require("./hue.names");
|
|
17
|
+
Object.defineProperty(exports, "hueNames", { enumerable: true, get: function () { return hue_names_1.hueNames; } });
|