@xivdyetools/core 1.6.0 → 1.8.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.
- package/README.md +17 -2
- package/dist/data/character_colors.json +1 -0
- package/dist/data/locales/de.json +1 -1
- package/dist/data/locales/en.json +1 -1
- package/dist/data/locales/fr.json +1 -1
- package/dist/data/locales/ja.json +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/services/CharacterColorService.d.ts +125 -0
- package/dist/services/CharacterColorService.d.ts.map +1 -0
- package/dist/services/CharacterColorService.js +223 -0
- package/dist/services/CharacterColorService.js.map +1 -0
- package/dist/services/DyeService.d.ts +30 -9
- package/dist/services/DyeService.d.ts.map +1 -1
- package/dist/services/DyeService.js +38 -18
- package/dist/services/DyeService.js.map +1 -1
- package/dist/services/color/ColorConverter.d.ts +74 -1
- package/dist/services/color/ColorConverter.d.ts.map +1 -1
- package/dist/services/color/ColorConverter.js +212 -0
- package/dist/services/color/ColorConverter.js.map +1 -1
- package/dist/services/dye/DyeDatabase.d.ts +5 -2
- package/dist/services/dye/DyeDatabase.d.ts.map +1 -1
- package/dist/services/dye/DyeDatabase.js +21 -1
- package/dist/services/dye/DyeDatabase.js.map +1 -1
- package/dist/services/dye/HarmonyGenerator.d.ts +82 -11
- package/dist/services/dye/HarmonyGenerator.d.ts.map +1 -1
- package/dist/services/dye/HarmonyGenerator.js +130 -21
- package/dist/services/dye/HarmonyGenerator.js.map +1 -1
- package/dist/types/index.d.ts +6 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -4,8 +4,43 @@
|
|
|
4
4
|
* Handles triadic, analogous, complementary, and other harmony schemes
|
|
5
5
|
*/
|
|
6
6
|
import type { Dye } from '../../types/index.js';
|
|
7
|
+
import { type DeltaEFormula } from '../color/ColorConverter.js';
|
|
7
8
|
import type { DyeDatabase } from './DyeDatabase.js';
|
|
8
9
|
import type { DyeSearch } from './DyeSearch.js';
|
|
10
|
+
/**
|
|
11
|
+
* Algorithm used for finding matching dyes in harmony calculations
|
|
12
|
+
* - 'hue': Current algorithm - matches based on hue angle offsets (fast, hue-bucket indexed)
|
|
13
|
+
* - 'deltaE': DeltaE-based matching - matches based on perceptual color difference
|
|
14
|
+
*/
|
|
15
|
+
export type HarmonyMatchingAlgorithm = 'hue' | 'deltaE';
|
|
16
|
+
/**
|
|
17
|
+
* Options for harmony generation methods
|
|
18
|
+
*/
|
|
19
|
+
export interface HarmonyOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Algorithm for finding matching dyes
|
|
22
|
+
* @default 'hue'
|
|
23
|
+
*/
|
|
24
|
+
algorithm?: HarmonyMatchingAlgorithm;
|
|
25
|
+
/**
|
|
26
|
+
* DeltaE formula (only used when algorithm is 'deltaE')
|
|
27
|
+
* @default 'cie76'
|
|
28
|
+
*/
|
|
29
|
+
deltaEFormula?: DeltaEFormula;
|
|
30
|
+
/**
|
|
31
|
+
* Tolerance for hue-based matching (degrees, 0-180)
|
|
32
|
+
* Only used when algorithm is 'hue'
|
|
33
|
+
* @default 45
|
|
34
|
+
*/
|
|
35
|
+
hueTolerance?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum DeltaE distance for matching
|
|
38
|
+
* Only used when algorithm is 'deltaE'
|
|
39
|
+
* Higher values return more matches but less precise
|
|
40
|
+
* @default 40 (for cie76), 25 (for cie2000)
|
|
41
|
+
*/
|
|
42
|
+
deltaETolerance?: number;
|
|
43
|
+
}
|
|
9
44
|
/**
|
|
10
45
|
* Color harmony generator
|
|
11
46
|
* Per R-4: Single Responsibility - harmony generation only
|
|
@@ -17,8 +52,10 @@ export declare class HarmonyGenerator {
|
|
|
17
52
|
/**
|
|
18
53
|
* Find dyes that form a complementary color pair
|
|
19
54
|
* Excludes Facewear dyes (generic names like "Red", "Blue")
|
|
55
|
+
* @param hex Base hex color
|
|
56
|
+
* @param options Matching algorithm options
|
|
20
57
|
*/
|
|
21
|
-
findComplementaryPair(hex: string): Dye | null;
|
|
58
|
+
findComplementaryPair(hex: string, options?: HarmonyOptions): Dye | null;
|
|
22
59
|
/**
|
|
23
60
|
* Find the closest dye that is not Facewear
|
|
24
61
|
*
|
|
@@ -31,61 +68,87 @@ export declare class HarmonyGenerator {
|
|
|
31
68
|
* Find analogous dyes (adjacent on color wheel)
|
|
32
69
|
* Returns dyes at ±angle degrees from the base color
|
|
33
70
|
*
|
|
71
|
+
* @param hex Base hex color
|
|
72
|
+
* @param angle Hue offset in degrees (default: 30)
|
|
73
|
+
* @param options Matching algorithm options
|
|
74
|
+
*
|
|
34
75
|
* @remarks
|
|
35
76
|
* May return fewer dyes than expected if no suitable matches exist
|
|
36
77
|
* at the target hue positions or if all candidates are excluded.
|
|
37
78
|
*/
|
|
38
|
-
findAnalogousDyes(hex: string, angle?: number): Dye[];
|
|
79
|
+
findAnalogousDyes(hex: string, angle?: number, options?: HarmonyOptions): Dye[];
|
|
39
80
|
/**
|
|
40
81
|
* Find triadic color scheme (colors 120° apart on color wheel)
|
|
41
82
|
*
|
|
83
|
+
* @param hex Base hex color
|
|
84
|
+
* @param options Matching algorithm options
|
|
85
|
+
*
|
|
42
86
|
* @remarks
|
|
43
87
|
* May return 0, 1, or 2 dyes depending on available matches.
|
|
44
88
|
* Use the length of the returned array to determine actual results.
|
|
45
89
|
*/
|
|
46
|
-
findTriadicDyes(hex: string): Dye[];
|
|
90
|
+
findTriadicDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
47
91
|
/**
|
|
48
92
|
* Find square color scheme (colors 90° apart on color wheel)
|
|
49
93
|
*
|
|
94
|
+
* @param hex Base hex color
|
|
95
|
+
* @param options Matching algorithm options
|
|
96
|
+
*
|
|
50
97
|
* @remarks
|
|
51
98
|
* May return fewer than 3 dyes if suitable matches are not found.
|
|
52
99
|
*/
|
|
53
|
-
findSquareDyes(hex: string): Dye[];
|
|
100
|
+
findSquareDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
54
101
|
/**
|
|
55
102
|
* Find tetradic color scheme (two complementary pairs)
|
|
56
103
|
*
|
|
104
|
+
* @param hex Base hex color
|
|
105
|
+
* @param options Matching algorithm options
|
|
106
|
+
*
|
|
57
107
|
* @remarks
|
|
58
108
|
* May return fewer than 3 dyes if suitable matches are not found.
|
|
59
109
|
*/
|
|
60
|
-
findTetradicDyes(hex: string): Dye[];
|
|
110
|
+
findTetradicDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
61
111
|
/**
|
|
62
112
|
* Find monochromatic dyes (same hue, varying saturation/brightness)
|
|
63
113
|
* Excludes Facewear dyes (generic names like "Red", "Blue")
|
|
114
|
+
*
|
|
115
|
+
* @param hex Base hex color
|
|
116
|
+
* @param limit Maximum number of dyes to return (default: 6)
|
|
117
|
+
* @param options Matching algorithm options
|
|
64
118
|
*/
|
|
65
|
-
findMonochromaticDyes(hex: string, limit?: number): Dye[];
|
|
119
|
+
findMonochromaticDyes(hex: string, limit?: number, options?: HarmonyOptions): Dye[];
|
|
66
120
|
/**
|
|
67
121
|
* Find compound harmony (analogous + complementary)
|
|
68
122
|
*
|
|
123
|
+
* @param hex Base hex color
|
|
124
|
+
* @param options Matching algorithm options
|
|
125
|
+
*
|
|
69
126
|
* @remarks
|
|
70
127
|
* May return fewer than 3 dyes if suitable matches are not found.
|
|
71
128
|
*/
|
|
72
|
-
findCompoundDyes(hex: string): Dye[];
|
|
129
|
+
findCompoundDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
73
130
|
/**
|
|
74
131
|
* Find split-complementary harmony (±30° from the complementary hue)
|
|
75
132
|
*
|
|
133
|
+
* @param hex Base hex color
|
|
134
|
+
* @param options Matching algorithm options
|
|
135
|
+
*
|
|
76
136
|
* @remarks
|
|
77
137
|
* May return 0, 1, or 2 dyes depending on available matches.
|
|
78
138
|
*/
|
|
79
|
-
findSplitComplementaryDyes(hex: string): Dye[];
|
|
139
|
+
findSplitComplementaryDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
80
140
|
/**
|
|
81
141
|
* Find shades (similar tones, ±15°)
|
|
82
142
|
*
|
|
143
|
+
* @param hex Base hex color
|
|
144
|
+
* @param options Matching algorithm options
|
|
145
|
+
*
|
|
83
146
|
* @remarks
|
|
84
147
|
* May return 0, 1, or 2 dyes depending on available matches.
|
|
85
148
|
*/
|
|
86
|
-
findShadesDyes(hex: string): Dye[];
|
|
149
|
+
findShadesDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
87
150
|
/**
|
|
88
|
-
* Generic helper for hue-based harmonies
|
|
151
|
+
* Generic helper for hue-based and DeltaE-based harmonies
|
|
89
152
|
*
|
|
90
153
|
* @remarks
|
|
91
154
|
* This method may return fewer dyes than the number of offsets provided.
|
|
@@ -99,10 +162,18 @@ export declare class HarmonyGenerator {
|
|
|
99
162
|
*
|
|
100
163
|
* @param hex - Base hex color
|
|
101
164
|
* @param offsets - Array of hue offsets in degrees
|
|
102
|
-
* @param
|
|
165
|
+
* @param internalOptions - Internal options (tolerance for hue-based matching)
|
|
166
|
+
* @param harmonyOptions - User-provided harmony options
|
|
103
167
|
* @returns Array of matched dyes (may be shorter than offsets array)
|
|
104
168
|
*/
|
|
105
169
|
private findHarmonyDyesByOffsets;
|
|
170
|
+
/**
|
|
171
|
+
* Find closest dye using DeltaE color difference
|
|
172
|
+
* @param targetHex - Target color in hex format
|
|
173
|
+
* @param excludeIds - Dye IDs to exclude from results
|
|
174
|
+
* @param options - DeltaE options (formula, tolerance)
|
|
175
|
+
*/
|
|
176
|
+
private findClosestByDeltaE;
|
|
106
177
|
/**
|
|
107
178
|
* Find closest dye by hue difference with graceful fallback
|
|
108
179
|
* Per P-2: Uses hue-indexed map for 70-90% speedup
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HarmonyGenerator.d.ts","sourceRoot":"","sources":["../../../src/services/dye/HarmonyGenerator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"HarmonyGenerator.d.ts","sourceRoot":"","sources":["../../../src/services/dye/HarmonyGenerator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAO,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,wBAAwB,CAAC;IAErC;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;gBADN,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,SAAS;IAG3B;;;;;OAKG;IACH,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,GAAG,IAAI;IAmBxE;;;;;;OAMG;IACH,OAAO,CAAC,yBAAyB;IAKjC;;;;;;;;;;;OAWG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAKnF;;;;;;;;;OASG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAI7D;;;;;;;;OAQG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAI5D;;;;;;;;OAQG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAK9D;;;;;;;OAOG;IACH,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAoEtF;;;;;;;;OAQG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAK9D;;;;;;;;OAQG;IACH,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAIxE;;;;;;;;OAQG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAO5D;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,wBAAwB;IAmDhC;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAoC3B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CAsC5B"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Handles triadic, analogous, complementary, and other harmony schemes
|
|
5
5
|
*/
|
|
6
6
|
import { ColorManipulator } from '../color/ColorManipulator.js';
|
|
7
|
+
import { ColorConverter } from '../color/ColorConverter.js';
|
|
7
8
|
/**
|
|
8
9
|
* Color harmony generator
|
|
9
10
|
* Per R-4: Single Responsibility - harmony generation only
|
|
@@ -16,11 +17,17 @@ export class HarmonyGenerator {
|
|
|
16
17
|
/**
|
|
17
18
|
* Find dyes that form a complementary color pair
|
|
18
19
|
* Excludes Facewear dyes (generic names like "Red", "Blue")
|
|
20
|
+
* @param hex Base hex color
|
|
21
|
+
* @param options Matching algorithm options
|
|
19
22
|
*/
|
|
20
|
-
findComplementaryPair(hex) {
|
|
23
|
+
findComplementaryPair(hex, options) {
|
|
21
24
|
this.database.ensureLoaded();
|
|
22
25
|
try {
|
|
23
26
|
const complementaryHex = ColorManipulator.invert(hex);
|
|
27
|
+
// Use DeltaE matching if requested
|
|
28
|
+
if (options?.algorithm === 'deltaE') {
|
|
29
|
+
return this.findClosestByDeltaE(complementaryHex, new Set(), options);
|
|
30
|
+
}
|
|
24
31
|
// Find closest dye, excluding Facewear
|
|
25
32
|
return this.findClosestNonFacewearDye(complementaryHex);
|
|
26
33
|
}
|
|
@@ -44,55 +51,99 @@ export class HarmonyGenerator {
|
|
|
44
51
|
* Find analogous dyes (adjacent on color wheel)
|
|
45
52
|
* Returns dyes at ±angle degrees from the base color
|
|
46
53
|
*
|
|
54
|
+
* @param hex Base hex color
|
|
55
|
+
* @param angle Hue offset in degrees (default: 30)
|
|
56
|
+
* @param options Matching algorithm options
|
|
57
|
+
*
|
|
47
58
|
* @remarks
|
|
48
59
|
* May return fewer dyes than expected if no suitable matches exist
|
|
49
60
|
* at the target hue positions or if all candidates are excluded.
|
|
50
61
|
*/
|
|
51
|
-
findAnalogousDyes(hex, angle = 30) {
|
|
62
|
+
findAnalogousDyes(hex, angle = 30, options) {
|
|
52
63
|
// Use harmony helper to find dyes at +angle and -angle positions
|
|
53
|
-
return this.findHarmonyDyesByOffsets(hex, [angle, -angle]);
|
|
64
|
+
return this.findHarmonyDyesByOffsets(hex, [angle, -angle], {}, options);
|
|
54
65
|
}
|
|
55
66
|
/**
|
|
56
67
|
* Find triadic color scheme (colors 120° apart on color wheel)
|
|
57
68
|
*
|
|
69
|
+
* @param hex Base hex color
|
|
70
|
+
* @param options Matching algorithm options
|
|
71
|
+
*
|
|
58
72
|
* @remarks
|
|
59
73
|
* May return 0, 1, or 2 dyes depending on available matches.
|
|
60
74
|
* Use the length of the returned array to determine actual results.
|
|
61
75
|
*/
|
|
62
|
-
findTriadicDyes(hex) {
|
|
63
|
-
return this.findHarmonyDyesByOffsets(hex, [120, 240]);
|
|
76
|
+
findTriadicDyes(hex, options) {
|
|
77
|
+
return this.findHarmonyDyesByOffsets(hex, [120, 240], {}, options);
|
|
64
78
|
}
|
|
65
79
|
/**
|
|
66
80
|
* Find square color scheme (colors 90° apart on color wheel)
|
|
67
81
|
*
|
|
82
|
+
* @param hex Base hex color
|
|
83
|
+
* @param options Matching algorithm options
|
|
84
|
+
*
|
|
68
85
|
* @remarks
|
|
69
86
|
* May return fewer than 3 dyes if suitable matches are not found.
|
|
70
87
|
*/
|
|
71
|
-
findSquareDyes(hex) {
|
|
72
|
-
return this.findHarmonyDyesByOffsets(hex, [90, 180, 270]);
|
|
88
|
+
findSquareDyes(hex, options) {
|
|
89
|
+
return this.findHarmonyDyesByOffsets(hex, [90, 180, 270], {}, options);
|
|
73
90
|
}
|
|
74
91
|
/**
|
|
75
92
|
* Find tetradic color scheme (two complementary pairs)
|
|
76
93
|
*
|
|
94
|
+
* @param hex Base hex color
|
|
95
|
+
* @param options Matching algorithm options
|
|
96
|
+
*
|
|
77
97
|
* @remarks
|
|
78
98
|
* May return fewer than 3 dyes if suitable matches are not found.
|
|
79
99
|
*/
|
|
80
|
-
findTetradicDyes(hex) {
|
|
100
|
+
findTetradicDyes(hex, options) {
|
|
81
101
|
// Two adjacent hues + their complements (e.g., base+60 and base+240)
|
|
82
|
-
return this.findHarmonyDyesByOffsets(hex, [60, 180, 240]);
|
|
102
|
+
return this.findHarmonyDyesByOffsets(hex, [60, 180, 240], {}, options);
|
|
83
103
|
}
|
|
84
104
|
/**
|
|
85
105
|
* Find monochromatic dyes (same hue, varying saturation/brightness)
|
|
86
106
|
* Excludes Facewear dyes (generic names like "Red", "Blue")
|
|
107
|
+
*
|
|
108
|
+
* @param hex Base hex color
|
|
109
|
+
* @param limit Maximum number of dyes to return (default: 6)
|
|
110
|
+
* @param options Matching algorithm options
|
|
87
111
|
*/
|
|
88
|
-
findMonochromaticDyes(hex, limit = 6) {
|
|
112
|
+
findMonochromaticDyes(hex, limit = 6, options) {
|
|
89
113
|
this.database.ensureLoaded();
|
|
90
114
|
const baseDye = this.findClosestNonFacewearDye(hex);
|
|
91
115
|
if (!baseDye)
|
|
92
116
|
return [];
|
|
117
|
+
const dyes = this.database.getDyesInternal();
|
|
118
|
+
// DeltaE-based monochromatic search
|
|
119
|
+
if (options?.algorithm === 'deltaE') {
|
|
120
|
+
const baseLab = ColorConverter.hexToLab(baseDye.hex);
|
|
121
|
+
const formula = options.deltaEFormula ?? 'cie76';
|
|
122
|
+
const tolerance = options.deltaETolerance ?? (formula === 'cie2000' ? 25 : 40);
|
|
123
|
+
const results = [];
|
|
124
|
+
for (const dye of dyes) {
|
|
125
|
+
if (dye.category === 'Facewear' || dye.id === baseDye.id)
|
|
126
|
+
continue;
|
|
127
|
+
// Use pre-computed LAB if available, otherwise compute
|
|
128
|
+
const dyeLab = dye.lab ?? ColorConverter.hexToLab(dye.hex);
|
|
129
|
+
const deltaE = formula === 'cie2000'
|
|
130
|
+
? ColorConverter.getDeltaE2000(baseLab, dyeLab)
|
|
131
|
+
: ColorConverter.getDeltaE76(baseLab, dyeLab);
|
|
132
|
+
// For monochromatic, we want colors that are perceptually similar
|
|
133
|
+
// but have varying lightness (L component)
|
|
134
|
+
if (deltaE <= tolerance) {
|
|
135
|
+
const satDiff = Math.abs(dye.hsv.s - baseDye.hsv.s);
|
|
136
|
+
const valDiff = Math.abs(dye.hsv.v - baseDye.hsv.v);
|
|
137
|
+
results.push({ dye, deltaE, satValDiff: satDiff + valDiff });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Sort by saturation/value difference (prefer more variety)
|
|
141
|
+
results.sort((a, b) => b.satValDiff - a.satValDiff);
|
|
142
|
+
return results.slice(0, limit).map((item) => item.dye);
|
|
143
|
+
}
|
|
144
|
+
// Hue-based monochromatic search (original algorithm)
|
|
93
145
|
const baseHue = baseDye.hsv.h;
|
|
94
146
|
const results = [];
|
|
95
|
-
const dyes = this.database.getDyesInternal();
|
|
96
147
|
// Find dyes with similar hue but different saturation/value
|
|
97
148
|
for (const dye of dyes) {
|
|
98
149
|
// Skip Facewear dyes (generic names)
|
|
@@ -115,35 +166,44 @@ export class HarmonyGenerator {
|
|
|
115
166
|
/**
|
|
116
167
|
* Find compound harmony (analogous + complementary)
|
|
117
168
|
*
|
|
169
|
+
* @param hex Base hex color
|
|
170
|
+
* @param options Matching algorithm options
|
|
171
|
+
*
|
|
118
172
|
* @remarks
|
|
119
173
|
* May return fewer than 3 dyes if suitable matches are not found.
|
|
120
174
|
*/
|
|
121
|
-
findCompoundDyes(hex) {
|
|
175
|
+
findCompoundDyes(hex, options) {
|
|
122
176
|
// ±30° from base + complement
|
|
123
|
-
return this.findHarmonyDyesByOffsets(hex, [30, -30, 180], { tolerance: 35 });
|
|
177
|
+
return this.findHarmonyDyesByOffsets(hex, [30, -30, 180], { tolerance: 35 }, options);
|
|
124
178
|
}
|
|
125
179
|
/**
|
|
126
180
|
* Find split-complementary harmony (±30° from the complementary hue)
|
|
127
181
|
*
|
|
182
|
+
* @param hex Base hex color
|
|
183
|
+
* @param options Matching algorithm options
|
|
184
|
+
*
|
|
128
185
|
* @remarks
|
|
129
186
|
* May return 0, 1, or 2 dyes depending on available matches.
|
|
130
187
|
*/
|
|
131
|
-
findSplitComplementaryDyes(hex) {
|
|
132
|
-
return this.findHarmonyDyesByOffsets(hex, [150, 210]);
|
|
188
|
+
findSplitComplementaryDyes(hex, options) {
|
|
189
|
+
return this.findHarmonyDyesByOffsets(hex, [150, 210], {}, options);
|
|
133
190
|
}
|
|
134
191
|
/**
|
|
135
192
|
* Find shades (similar tones, ±15°)
|
|
136
193
|
*
|
|
194
|
+
* @param hex Base hex color
|
|
195
|
+
* @param options Matching algorithm options
|
|
196
|
+
*
|
|
137
197
|
* @remarks
|
|
138
198
|
* May return 0, 1, or 2 dyes depending on available matches.
|
|
139
199
|
*/
|
|
140
|
-
findShadesDyes(hex) {
|
|
200
|
+
findShadesDyes(hex, options) {
|
|
141
201
|
this.database.ensureLoaded();
|
|
142
202
|
// Use tighter tolerance (5°) for shades to ensure results are close to target hue
|
|
143
|
-
return this.findHarmonyDyesByOffsets(hex, [15, -15], { tolerance: 5 });
|
|
203
|
+
return this.findHarmonyDyesByOffsets(hex, [15, -15], { tolerance: 5 }, options);
|
|
144
204
|
}
|
|
145
205
|
/**
|
|
146
|
-
* Generic helper for hue-based harmonies
|
|
206
|
+
* Generic helper for hue-based and DeltaE-based harmonies
|
|
147
207
|
*
|
|
148
208
|
* @remarks
|
|
149
209
|
* This method may return fewer dyes than the number of offsets provided.
|
|
@@ -157,18 +217,37 @@ export class HarmonyGenerator {
|
|
|
157
217
|
*
|
|
158
218
|
* @param hex - Base hex color
|
|
159
219
|
* @param offsets - Array of hue offsets in degrees
|
|
160
|
-
* @param
|
|
220
|
+
* @param internalOptions - Internal options (tolerance for hue-based matching)
|
|
221
|
+
* @param harmonyOptions - User-provided harmony options
|
|
161
222
|
* @returns Array of matched dyes (may be shorter than offsets array)
|
|
162
223
|
*/
|
|
163
|
-
findHarmonyDyesByOffsets(hex, offsets,
|
|
224
|
+
findHarmonyDyesByOffsets(hex, offsets, internalOptions = {}, harmonyOptions) {
|
|
164
225
|
this.database.ensureLoaded();
|
|
165
226
|
const baseDye = this.search.findClosestDye(hex);
|
|
166
227
|
if (!baseDye)
|
|
167
228
|
return [];
|
|
168
229
|
const usedDyeIds = new Set([baseDye.id]);
|
|
169
230
|
const results = [];
|
|
231
|
+
// Check if using DeltaE algorithm
|
|
232
|
+
if (harmonyOptions?.algorithm === 'deltaE') {
|
|
233
|
+
// For DeltaE, we still calculate target colors from hue offsets,
|
|
234
|
+
// but match using perceptual distance instead of hue distance
|
|
235
|
+
const baseHsv = baseDye.hsv;
|
|
236
|
+
for (const offset of offsets) {
|
|
237
|
+
const targetHue = (baseHsv.h + offset + 360) % 360;
|
|
238
|
+
// Generate target color at that hue (keeping same saturation/value)
|
|
239
|
+
const targetHex = ColorConverter.hsvToHex(targetHue, baseHsv.s, baseHsv.v);
|
|
240
|
+
const match = this.findClosestByDeltaE(targetHex, usedDyeIds, harmonyOptions);
|
|
241
|
+
if (match) {
|
|
242
|
+
results.push(match);
|
|
243
|
+
usedDyeIds.add(match.id);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return results;
|
|
247
|
+
}
|
|
248
|
+
// Original hue-based logic
|
|
170
249
|
const baseHue = baseDye.hsv.h;
|
|
171
|
-
const tolerance =
|
|
250
|
+
const tolerance = harmonyOptions?.hueTolerance ?? internalOptions.tolerance ?? 45;
|
|
172
251
|
for (const offset of offsets) {
|
|
173
252
|
const targetHue = (baseHue + offset + 360) % 360;
|
|
174
253
|
const match = this.findClosestDyeByHue(targetHue, usedDyeIds, tolerance);
|
|
@@ -179,6 +258,36 @@ export class HarmonyGenerator {
|
|
|
179
258
|
}
|
|
180
259
|
return results;
|
|
181
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Find closest dye using DeltaE color difference
|
|
263
|
+
* @param targetHex - Target color in hex format
|
|
264
|
+
* @param excludeIds - Dye IDs to exclude from results
|
|
265
|
+
* @param options - DeltaE options (formula, tolerance)
|
|
266
|
+
*/
|
|
267
|
+
findClosestByDeltaE(targetHex, excludeIds, options) {
|
|
268
|
+
const formula = options.deltaEFormula ?? 'cie76';
|
|
269
|
+
const tolerance = options.deltaETolerance ?? (formula === 'cie2000' ? 25 : 40);
|
|
270
|
+
const targetLab = ColorConverter.hexToLab(targetHex);
|
|
271
|
+
let bestMatch = null;
|
|
272
|
+
let bestDeltaE = Infinity;
|
|
273
|
+
const dyes = this.database.getDyesInternal();
|
|
274
|
+
for (const dye of dyes) {
|
|
275
|
+
if (excludeIds.has(dye.id) || dye.category === 'Facewear') {
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
// Use pre-computed LAB if available, otherwise compute
|
|
279
|
+
const dyeLab = dye.lab ?? ColorConverter.hexToLab(dye.hex);
|
|
280
|
+
const deltaE = formula === 'cie2000'
|
|
281
|
+
? ColorConverter.getDeltaE2000(targetLab, dyeLab)
|
|
282
|
+
: ColorConverter.getDeltaE76(targetLab, dyeLab);
|
|
283
|
+
if (deltaE < bestDeltaE) {
|
|
284
|
+
bestDeltaE = deltaE;
|
|
285
|
+
bestMatch = dye;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// Only return if within tolerance
|
|
289
|
+
return bestDeltaE <= tolerance ? bestMatch : null;
|
|
290
|
+
}
|
|
182
291
|
/**
|
|
183
292
|
* Find closest dye by hue difference with graceful fallback
|
|
184
293
|
* Per P-2: Uses hue-indexed map for 70-90% speedup
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HarmonyGenerator.js","sourceRoot":"","sources":["../../../src/services/dye/HarmonyGenerator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"HarmonyGenerator.js","sourceRoot":"","sources":["../../../src/services/dye/HarmonyGenerator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAsB,MAAM,4BAA4B,CAAC;AA2ChF;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAC3B,YACU,QAAqB,EACrB,MAAiB;QADjB,aAAQ,GAAR,QAAQ,CAAa;QACrB,WAAM,GAAN,MAAM,CAAW;IACxB,CAAC;IAEJ;;;;;OAKG;IACH,qBAAqB,CAAC,GAAW,EAAE,OAAwB;QACzD,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;QAE7B,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CA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CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;oBACvD,SAAS;gBACX,CAAC;gBAED,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CACnB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,EAC/B,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CACtC,CAAC;gBAEF,IAAI,CAAC,WAAW,IAAI,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;oBAC5C,WAAW,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;gBAC9B,CAAC;gBAED,IAAI,IAAI,IAAI,SAAS,EAAE,CAAC;oBACtB,IAAI,CAAC,eAAe,IAAI,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC;wBACpD,eAAe,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;oBAClC,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,eAAe,EAAE,GAAG,IAAI,WAAW,EAAE,GAAG,IAAI,IAAI,CAAC;IAC1D,CAAC;CACF"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { NoOpLogger, ConsoleLogger } from '@xivdyetools/logger/library';
|
|
|
20
20
|
/**
|
|
21
21
|
* @deprecated Removed in v2.0.0. Import directly from '@xivdyetools/types' instead.
|
|
22
22
|
*/
|
|
23
|
-
export type { RGB, HSV, HexColor, DyeId, Hue, Saturation } from '@xivdyetools/types';
|
|
23
|
+
export type { RGB, HSV, LAB, HexColor, DyeId, Hue, Saturation } from '@xivdyetools/types';
|
|
24
24
|
/**
|
|
25
25
|
* @deprecated Removed in v2.0.0. Import directly from '@xivdyetools/types' instead.
|
|
26
26
|
*/
|
|
@@ -33,6 +33,11 @@ export type { VisionType, Matrix3x3, ColorblindMatrices } from '@xivdyetools/typ
|
|
|
33
33
|
* @deprecated Removed in v2.0.0. Import directly from '@xivdyetools/types' instead.
|
|
34
34
|
*/
|
|
35
35
|
export type { Dye, LocalizedDye, DyeWithDistance, DyeDatabase } from '@xivdyetools/types';
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Removed in v2.0.0. Import directly from '@xivdyetools/types' instead.
|
|
38
|
+
*/
|
|
39
|
+
export type { CharacterColor, CharacterColorMatch, SharedColorCategory, RaceSpecificColorCategory, CharacterColorCategory, SubRace, Gender, Race, } from '@xivdyetools/types';
|
|
40
|
+
export { RACE_SUBRACES, SUBRACE_TO_RACE, COLOR_GRID_DIMENSIONS } from '@xivdyetools/types';
|
|
36
41
|
/**
|
|
37
42
|
* @deprecated Removed in v2.0.0. Import directly from '@xivdyetools/types' instead.
|
|
38
43
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,YAAY,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMxE;;GAEG;AACH,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,YAAY,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMxE;;GAEG;AACH,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,KAA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AChB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,YAAY,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,MAAM,EACN,eAAe,EACf,UAAU,EACV,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzD;;GAEG;AACH,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAClF;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { NoOpLogger, ConsoleLogger } from '@xivdyetools/logger/library';
|
|
|
17
17
|
* @deprecated Removed in v2.0.0. Import directly from '@xivdyetools/types' instead.
|
|
18
18
|
*/
|
|
19
19
|
export { createHexColor, createDyeId, createHue, createSaturation } from '@xivdyetools/types';
|
|
20
|
+
export { RACE_SUBRACES, SUBRACE_TO_RACE, COLOR_GRID_DIMENSIONS } from '@xivdyetools/types';
|
|
20
21
|
/**
|
|
21
22
|
* @deprecated Removed in v2.0.0. Import directly from '@xivdyetools/types' instead.
|
|
22
23
|
*/
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAUxE;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAUxE;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAwB9F,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AA2E3F;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAUzD;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xivdyetools/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Core color algorithms and dye database for XIV Dye Tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@xivdyetools/logger": "^1.0.2",
|
|
80
|
-
"@xivdyetools/types": "^1.
|
|
80
|
+
"@xivdyetools/types": "^1.4.0"
|
|
81
81
|
},
|
|
82
82
|
"lint-staged": {
|
|
83
83
|
"*.ts": [
|