@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
package/dist/index.d.ts
CHANGED
|
@@ -6,11 +6,15 @@ export { LocalizationService } from './services/LocalizationService.js';
|
|
|
6
6
|
export { PresetService } from './services/PresetService.js';
|
|
7
7
|
export { PaletteService } from './services/PaletteService.js';
|
|
8
8
|
export type { PaletteExtractionOptions, ExtractedColor, PaletteMatch, PaletteServiceOptions, } from './services/PaletteService.js';
|
|
9
|
-
export
|
|
10
|
-
export {
|
|
9
|
+
export { CharacterColorService } from './services/CharacterColorService.js';
|
|
10
|
+
export type { Dye, LocalizedDye, RGB, HSV, LAB, HexColor, VisionType, Matrix3x3, ColorblindMatrices, ErrorSeverity, PriceData, CachedData, LocaleCode, TranslationKey, HarmonyTypeKey, JobKey, GrandCompanyKey, LocaleData, LocalePreference, Logger, PresetCategory, CategoryMeta, PresetPalette, ResolvedPreset, PresetData, PresetStatus, CommunityPreset, PresetSubmission, PresetListResponse, PresetSubmitResponse, VoteResponse, PresetFilters, CharacterColor, CharacterColorMatch, SubRace, Gender, Race, } from './types/index.js';
|
|
11
|
+
export type { HarmonyOptions, HarmonyMatchingAlgorithm, } from './services/dye/HarmonyGenerator.js';
|
|
12
|
+
export type { DeltaEFormula } from './services/color/ColorConverter.js';
|
|
13
|
+
export { AppError, ErrorCode, createHexColor, NoOpLogger, ConsoleLogger, RACE_SUBRACES, SUBRACE_TO_RACE, COLOR_GRID_DIMENSIONS, } from './types/index.js';
|
|
11
14
|
export { RGB_MIN, RGB_MAX, HUE_MIN, HUE_MAX, SATURATION_MIN, SATURATION_MAX, VALUE_MIN, VALUE_MAX, COLOR_DISTANCE_MAX, VISION_TYPES, VISION_TYPE_LABELS, BRETTEL_MATRICES, PATTERNS, UNIVERSALIS_API_BASE, UNIVERSALIS_API_TIMEOUT, UNIVERSALIS_API_RETRY_COUNT, UNIVERSALIS_API_RETRY_DELAY, API_CACHE_TTL, API_DEBOUNCE_DELAY, API_CACHE_VERSION, API_MAX_RESPONSE_SIZE, API_RATE_LIMIT_DELAY, } from './constants/index.js';
|
|
12
15
|
export { clamp, lerp, round, distance, unique, groupBy, sortByProperty, filterNulls, isValidHexColor, isValidRGB, isValidHSV, isString, isNumber, isArray, isObject, isNullish, sleep, retry, isAbortError, generateChecksum, } from './utils/index.js';
|
|
13
16
|
export { default as dyeDatabase } from './data/colors_xiv.json';
|
|
14
17
|
export { default as presetData } from './data/presets.json';
|
|
18
|
+
export { default as characterColorData } from './data/character_colors.json';
|
|
15
19
|
export { VERSION } from './version.js';
|
|
16
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EACV,wBAAwB,EACxB,cAAc,EACd,YAAY,EACZ,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,E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ACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EACP,cAAc,EACd,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAuB;AACtF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAuB;AAClF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAuB;AAGnG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,10 @@ export { APIService, MemoryCacheBackend } from './services/APIService.js';
|
|
|
5
5
|
export { LocalizationService } from './services/LocalizationService.js';
|
|
6
6
|
export { PresetService } from './services/PresetService.js';
|
|
7
7
|
export { PaletteService } from './services/PaletteService.js';
|
|
8
|
-
export {
|
|
8
|
+
export { CharacterColorService } from './services/CharacterColorService.js';
|
|
9
|
+
export { AppError, ErrorCode, createHexColor, NoOpLogger, ConsoleLogger,
|
|
10
|
+
// Character constants
|
|
11
|
+
RACE_SUBRACES, SUBRACE_TO_RACE, COLOR_GRID_DIMENSIONS, } from './types/index.js';
|
|
9
12
|
// Constants
|
|
10
13
|
export { RGB_MIN, RGB_MAX, HUE_MIN, HUE_MAX, SATURATION_MIN, SATURATION_MAX, VALUE_MIN, VALUE_MAX, COLOR_DISTANCE_MAX, VISION_TYPES, VISION_TYPE_LABELS, BRETTEL_MATRICES, PATTERNS, UNIVERSALIS_API_BASE, UNIVERSALIS_API_TIMEOUT, UNIVERSALIS_API_RETRY_COUNT, UNIVERSALIS_API_RETRY_DELAY, API_CACHE_TTL, API_DEBOUNCE_DELAY, API_CACHE_VERSION, API_MAX_RESPONSE_SIZE, API_RATE_LIMIT_DELAY, } from './constants/index.js';
|
|
11
14
|
// Utils
|
|
@@ -13,6 +16,7 @@ export { clamp, lerp, round, distance, unique, groupBy, sortByProperty, filterNu
|
|
|
13
16
|
// Data (for browser environments - to be injected)
|
|
14
17
|
export { default as dyeDatabase } from './data/colors_xiv.json' with { type: 'json' };
|
|
15
18
|
export { default as presetData } from './data/presets.json' with { type: 'json' };
|
|
19
|
+
export { default as characterColorData } from './data/character_colors.json' with { type: 'json' };
|
|
16
20
|
// Version (auto-generated from package.json during build)
|
|
17
21
|
export { VERSION } from './version.js';
|
|
18
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAA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,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @xivdyetools/core - Character Color Service
|
|
3
|
+
*
|
|
4
|
+
* Service for accessing FFXIV character customization colors and
|
|
5
|
+
* finding matching dyes for hair, eye, skin tones etc.
|
|
6
|
+
*
|
|
7
|
+
* @module services/CharacterColorService
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { CharacterColorService, DyeService, dyeDatabase } from '@xivdyetools/core';
|
|
11
|
+
*
|
|
12
|
+
* const characterColors = new CharacterColorService();
|
|
13
|
+
* const dyeService = new DyeService(dyeDatabase);
|
|
14
|
+
*
|
|
15
|
+
* // Get all eye colors
|
|
16
|
+
* const eyeColors = characterColors.getEyeColors();
|
|
17
|
+
*
|
|
18
|
+
* // Find closest dyes to an eye color
|
|
19
|
+
* const matches = characterColors.findClosestDyes(eyeColors[47], dyeService, 3);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import type { CharacterColor, CharacterColorMatch, SharedColorCategory, RaceSpecificColorCategory, SubRace, Gender } from '@xivdyetools/types';
|
|
23
|
+
import type { DyeService } from './DyeService.js';
|
|
24
|
+
/**
|
|
25
|
+
* Service for accessing FFXIV character customization colors
|
|
26
|
+
*/
|
|
27
|
+
export declare class CharacterColorService {
|
|
28
|
+
private data;
|
|
29
|
+
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Get all eye colors (192 colors)
|
|
32
|
+
*/
|
|
33
|
+
getEyeColors(): CharacterColor[];
|
|
34
|
+
/**
|
|
35
|
+
* Get all hair highlight colors (192 colors)
|
|
36
|
+
*/
|
|
37
|
+
getHighlightColors(): CharacterColor[];
|
|
38
|
+
/**
|
|
39
|
+
* Get all dark lip colors (96 colors)
|
|
40
|
+
*/
|
|
41
|
+
getLipColorsDark(): CharacterColor[];
|
|
42
|
+
/**
|
|
43
|
+
* Get all light lip colors (96 colors)
|
|
44
|
+
*/
|
|
45
|
+
getLipColorsLight(): CharacterColor[];
|
|
46
|
+
/**
|
|
47
|
+
* Get all tattoo/limbal ring colors (192 colors)
|
|
48
|
+
*/
|
|
49
|
+
getTattooColors(): CharacterColor[];
|
|
50
|
+
/**
|
|
51
|
+
* Get all dark face paint colors (96 colors)
|
|
52
|
+
*/
|
|
53
|
+
getFacePaintColorsDark(): CharacterColor[];
|
|
54
|
+
/**
|
|
55
|
+
* Get all light face paint colors (96 colors)
|
|
56
|
+
*/
|
|
57
|
+
getFacePaintColorsLight(): CharacterColor[];
|
|
58
|
+
/**
|
|
59
|
+
* Get shared colors by category
|
|
60
|
+
*/
|
|
61
|
+
getSharedColors(category: SharedColorCategory): CharacterColor[];
|
|
62
|
+
/**
|
|
63
|
+
* Get hair colors for a specific subrace and gender (192 colors each)
|
|
64
|
+
*/
|
|
65
|
+
getHairColors(subrace: SubRace, gender: Gender): CharacterColor[];
|
|
66
|
+
/**
|
|
67
|
+
* Get skin colors for a specific subrace and gender (192 colors each)
|
|
68
|
+
*/
|
|
69
|
+
getSkinColors(subrace: SubRace, gender: Gender): CharacterColor[];
|
|
70
|
+
/**
|
|
71
|
+
* Get race-specific colors by category
|
|
72
|
+
*/
|
|
73
|
+
getRaceSpecificColors(category: RaceSpecificColorCategory, subrace: SubRace, gender: Gender): CharacterColor[];
|
|
74
|
+
/**
|
|
75
|
+
* Find the closest matching dyes to a character color
|
|
76
|
+
*
|
|
77
|
+
* @param color - The character color to match
|
|
78
|
+
* @param dyeService - DyeService instance for dye lookup
|
|
79
|
+
* @param count - Number of matches to return (default: 3)
|
|
80
|
+
* @returns Array of matches sorted by distance (closest first)
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const eyeColor = characterColors.getEyeColors()[47];
|
|
85
|
+
* const matches = characterColors.findClosestDyes(eyeColor, dyeService, 3);
|
|
86
|
+
*
|
|
87
|
+
* console.log(matches[0].dye.name); // "Chestnut Brown"
|
|
88
|
+
* console.log(matches[0].distance); // 4.2
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
findClosestDyes(color: CharacterColor, dyeService: DyeService, count?: number): CharacterColorMatch[];
|
|
92
|
+
/**
|
|
93
|
+
* Find the single closest dye to a character color
|
|
94
|
+
*/
|
|
95
|
+
findClosestDye(color: CharacterColor, dyeService: DyeService): CharacterColorMatch | null;
|
|
96
|
+
/**
|
|
97
|
+
* Find all dyes within a color distance threshold
|
|
98
|
+
*/
|
|
99
|
+
findDyesWithinDistance(color: CharacterColor, dyeService: DyeService, maxDistance: number): CharacterColorMatch[];
|
|
100
|
+
/**
|
|
101
|
+
* Get a specific color by index from a shared category
|
|
102
|
+
*/
|
|
103
|
+
getSharedColorByIndex(category: SharedColorCategory, index: number): CharacterColor | null;
|
|
104
|
+
/**
|
|
105
|
+
* Get a specific color by index from a race-specific category
|
|
106
|
+
*/
|
|
107
|
+
getRaceSpecificColorByIndex(category: RaceSpecificColorCategory, subrace: SubRace, gender: Gender, index: number): CharacterColor | null;
|
|
108
|
+
/**
|
|
109
|
+
* Get all available subraces
|
|
110
|
+
*/
|
|
111
|
+
getAvailableSubraces(): SubRace[];
|
|
112
|
+
/**
|
|
113
|
+
* Get the data version
|
|
114
|
+
*/
|
|
115
|
+
getVersion(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Get grid column count (always 8)
|
|
118
|
+
*/
|
|
119
|
+
getGridColumns(): number;
|
|
120
|
+
/**
|
|
121
|
+
* Calculate Euclidean distance in RGB space
|
|
122
|
+
*/
|
|
123
|
+
private calculateDistance;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=CharacterColorService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CharacterColorService.d.ts","sourceRoot":"","sources":["../../src/services/CharacterColorService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,OAAO,EACP,MAAM,E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Q,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAK1F;;OAEG;IACH,2BAA2B,CACzB,QAAQ,EAAE,yBAAyB,EACnC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,cAAc,GAAG,IAAI;IASxB;;OAEG;IACH,oBAAoB,IAAI,OAAO,EAAE;IAKjC;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,cAAc,IAAI,MAAM;IAQxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAM1B"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @xivdyetools/core - Character Color Service
|
|
3
|
+
*
|
|
4
|
+
* Service for accessing FFXIV character customization colors and
|
|
5
|
+
* finding matching dyes for hair, eye, skin tones etc.
|
|
6
|
+
*
|
|
7
|
+
* @module services/CharacterColorService
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { CharacterColorService, DyeService, dyeDatabase } from '@xivdyetools/core';
|
|
11
|
+
*
|
|
12
|
+
* const characterColors = new CharacterColorService();
|
|
13
|
+
* const dyeService = new DyeService(dyeDatabase);
|
|
14
|
+
*
|
|
15
|
+
* // Get all eye colors
|
|
16
|
+
* const eyeColors = characterColors.getEyeColors();
|
|
17
|
+
*
|
|
18
|
+
* // Find closest dyes to an eye color
|
|
19
|
+
* const matches = characterColors.findClosestDyes(eyeColors[47], dyeService, 3);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
// Import character color data
|
|
23
|
+
import characterColorData from '../data/character_colors.json';
|
|
24
|
+
/**
|
|
25
|
+
* Service for accessing FFXIV character customization colors
|
|
26
|
+
*/
|
|
27
|
+
export class CharacterColorService {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.data = characterColorData;
|
|
30
|
+
}
|
|
31
|
+
// ==========================================================================
|
|
32
|
+
// Shared Colors (Race-Agnostic)
|
|
33
|
+
// ==========================================================================
|
|
34
|
+
/**
|
|
35
|
+
* Get all eye colors (192 colors)
|
|
36
|
+
*/
|
|
37
|
+
getEyeColors() {
|
|
38
|
+
return this.data.shared.eyeColors || [];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get all hair highlight colors (192 colors)
|
|
42
|
+
*/
|
|
43
|
+
getHighlightColors() {
|
|
44
|
+
return this.data.shared.highlightColors || [];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get all dark lip colors (96 colors)
|
|
48
|
+
*/
|
|
49
|
+
getLipColorsDark() {
|
|
50
|
+
return this.data.shared.lipColorsDark || [];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get all light lip colors (96 colors)
|
|
54
|
+
*/
|
|
55
|
+
getLipColorsLight() {
|
|
56
|
+
return this.data.shared.lipColorsLight || [];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get all tattoo/limbal ring colors (192 colors)
|
|
60
|
+
*/
|
|
61
|
+
getTattooColors() {
|
|
62
|
+
return this.data.shared.tattooColors || [];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get all dark face paint colors (96 colors)
|
|
66
|
+
*/
|
|
67
|
+
getFacePaintColorsDark() {
|
|
68
|
+
return this.data.shared.facePaintColorsDark || [];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get all light face paint colors (96 colors)
|
|
72
|
+
*/
|
|
73
|
+
getFacePaintColorsLight() {
|
|
74
|
+
return this.data.shared.facePaintColorsLight || [];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get shared colors by category
|
|
78
|
+
*/
|
|
79
|
+
getSharedColors(category) {
|
|
80
|
+
return this.data.shared[category] || [];
|
|
81
|
+
}
|
|
82
|
+
// ==========================================================================
|
|
83
|
+
// Race-Specific Colors
|
|
84
|
+
// ==========================================================================
|
|
85
|
+
/**
|
|
86
|
+
* Get hair colors for a specific subrace and gender (192 colors each)
|
|
87
|
+
*/
|
|
88
|
+
getHairColors(subrace, gender) {
|
|
89
|
+
return this.data.raceSpecific.hairColors?.[subrace]?.[gender] || [];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get skin colors for a specific subrace and gender (192 colors each)
|
|
93
|
+
*/
|
|
94
|
+
getSkinColors(subrace, gender) {
|
|
95
|
+
return this.data.raceSpecific.skinColors?.[subrace]?.[gender] || [];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get race-specific colors by category
|
|
99
|
+
*/
|
|
100
|
+
getRaceSpecificColors(category, subrace, gender) {
|
|
101
|
+
return this.data.raceSpecific[category]?.[subrace]?.[gender] || [];
|
|
102
|
+
}
|
|
103
|
+
// ==========================================================================
|
|
104
|
+
// Color Matching
|
|
105
|
+
// ==========================================================================
|
|
106
|
+
/**
|
|
107
|
+
* Find the closest matching dyes to a character color
|
|
108
|
+
*
|
|
109
|
+
* @param color - The character color to match
|
|
110
|
+
* @param dyeService - DyeService instance for dye lookup
|
|
111
|
+
* @param count - Number of matches to return (default: 3)
|
|
112
|
+
* @returns Array of matches sorted by distance (closest first)
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const eyeColor = characterColors.getEyeColors()[47];
|
|
117
|
+
* const matches = characterColors.findClosestDyes(eyeColor, dyeService, 3);
|
|
118
|
+
*
|
|
119
|
+
* console.log(matches[0].dye.name); // "Chestnut Brown"
|
|
120
|
+
* console.log(matches[0].distance); // 4.2
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
findClosestDyes(color, dyeService, count = 3) {
|
|
124
|
+
const allDyes = dyeService.getAllDyes();
|
|
125
|
+
const results = [];
|
|
126
|
+
for (const dye of allDyes) {
|
|
127
|
+
// Skip Facewear dyes (not usable for regular glamour)
|
|
128
|
+
if (dye.category === 'Facewear') {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const distance = this.calculateDistance(color.rgb, dye.rgb);
|
|
132
|
+
results.push({
|
|
133
|
+
characterColor: color,
|
|
134
|
+
dye,
|
|
135
|
+
distance,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
// Sort by distance and return top N
|
|
139
|
+
results.sort((a, b) => a.distance - b.distance);
|
|
140
|
+
return results.slice(0, count);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Find the single closest dye to a character color
|
|
144
|
+
*/
|
|
145
|
+
findClosestDye(color, dyeService) {
|
|
146
|
+
const matches = this.findClosestDyes(color, dyeService, 1);
|
|
147
|
+
return matches[0] || null;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Find all dyes within a color distance threshold
|
|
151
|
+
*/
|
|
152
|
+
findDyesWithinDistance(color, dyeService, maxDistance) {
|
|
153
|
+
const allDyes = dyeService.getAllDyes();
|
|
154
|
+
const results = [];
|
|
155
|
+
for (const dye of allDyes) {
|
|
156
|
+
if (dye.category === 'Facewear') {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const distance = this.calculateDistance(color.rgb, dye.rgb);
|
|
160
|
+
if (distance <= maxDistance) {
|
|
161
|
+
results.push({
|
|
162
|
+
characterColor: color,
|
|
163
|
+
dye,
|
|
164
|
+
distance,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
results.sort((a, b) => a.distance - b.distance);
|
|
169
|
+
return results;
|
|
170
|
+
}
|
|
171
|
+
// ==========================================================================
|
|
172
|
+
// Color Lookup
|
|
173
|
+
// ==========================================================================
|
|
174
|
+
/**
|
|
175
|
+
* Get a specific color by index from a shared category
|
|
176
|
+
*/
|
|
177
|
+
getSharedColorByIndex(category, index) {
|
|
178
|
+
const colors = this.getSharedColors(category);
|
|
179
|
+
return colors.find((c) => c.index === index) || null;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get a specific color by index from a race-specific category
|
|
183
|
+
*/
|
|
184
|
+
getRaceSpecificColorByIndex(category, subrace, gender, index) {
|
|
185
|
+
const colors = this.getRaceSpecificColors(category, subrace, gender);
|
|
186
|
+
return colors.find((c) => c.index === index) || null;
|
|
187
|
+
}
|
|
188
|
+
// ==========================================================================
|
|
189
|
+
// Metadata
|
|
190
|
+
// ==========================================================================
|
|
191
|
+
/**
|
|
192
|
+
* Get all available subraces
|
|
193
|
+
*/
|
|
194
|
+
getAvailableSubraces() {
|
|
195
|
+
const hairColors = this.data.raceSpecific.hairColors || {};
|
|
196
|
+
return Object.keys(hairColors);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Get the data version
|
|
200
|
+
*/
|
|
201
|
+
getVersion() {
|
|
202
|
+
return this.data.meta.version;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get grid column count (always 8)
|
|
206
|
+
*/
|
|
207
|
+
getGridColumns() {
|
|
208
|
+
return this.data.meta.gridColumns;
|
|
209
|
+
}
|
|
210
|
+
// ==========================================================================
|
|
211
|
+
// Private Helpers
|
|
212
|
+
// ==========================================================================
|
|
213
|
+
/**
|
|
214
|
+
* Calculate Euclidean distance in RGB space
|
|
215
|
+
*/
|
|
216
|
+
calculateDistance(rgb1, rgb2) {
|
|
217
|
+
const dr = rgb1.r - rgb2.r;
|
|
218
|
+
const dg = rgb1.g - rgb2.g;
|
|
219
|
+
const db = rgb1.b - rgb2.b;
|
|
220
|
+
return Math.sqrt(dr * dr + dg * dg + db * db);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=CharacterColorService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CharacterColorService.js","sourceRoot":"","sources":["../../src/services/CharacterColorService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAaH,8BAA8B;AAC9B,OAAO,kBAAkB,MAAM,+BAA+B,CAAC;AAkB/D;;GAEG;AACH,MAAM,OAAO,qBAAqB;IA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onyOptions } from './dye/HarmonyGenerator.js';
|
|
28
29
|
/**
|
|
29
30
|
* Configuration options for DyeService
|
|
30
31
|
*/
|
|
@@ -131,41 +132,61 @@ export declare class DyeService {
|
|
|
131
132
|
getDyesSortedByHue(ascending?: boolean): Dye[];
|
|
132
133
|
/**
|
|
133
134
|
* Find dyes that form a complementary color pair
|
|
135
|
+
* @param hex Base hex color
|
|
136
|
+
* @param options Matching algorithm options (optional)
|
|
134
137
|
*/
|
|
135
|
-
findComplementaryPair(hex: string): Dye | null;
|
|
138
|
+
findComplementaryPair(hex: string, options?: HarmonyOptions): Dye | null;
|
|
136
139
|
/**
|
|
137
140
|
* Find analogous dyes (adjacent on color wheel)
|
|
138
141
|
* Returns dyes at ±angle degrees from the base color
|
|
142
|
+
* @param hex Base hex color
|
|
143
|
+
* @param angle Hue offset in degrees (default: 30)
|
|
144
|
+
* @param options Matching algorithm options (optional)
|
|
139
145
|
*/
|
|
140
|
-
findAnalogousDyes(hex: string, angle?: number): Dye[];
|
|
146
|
+
findAnalogousDyes(hex: string, angle?: number, options?: HarmonyOptions): Dye[];
|
|
141
147
|
/**
|
|
142
148
|
* Find triadic color scheme (colors 120° apart on color wheel)
|
|
149
|
+
* @param hex Base hex color
|
|
150
|
+
* @param options Matching algorithm options (optional)
|
|
143
151
|
*/
|
|
144
|
-
findTriadicDyes(hex: string): Dye[];
|
|
152
|
+
findTriadicDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
145
153
|
/**
|
|
146
154
|
* Find square color scheme (colors 90° apart on color wheel)
|
|
155
|
+
* @param hex Base hex color
|
|
156
|
+
* @param options Matching algorithm options (optional)
|
|
147
157
|
*/
|
|
148
|
-
findSquareDyes(hex: string): Dye[];
|
|
158
|
+
findSquareDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
149
159
|
/**
|
|
150
160
|
* Find tetradic color scheme (two complementary pairs)
|
|
161
|
+
* @param hex Base hex color
|
|
162
|
+
* @param options Matching algorithm options (optional)
|
|
151
163
|
*/
|
|
152
|
-
findTetradicDyes(hex: string): Dye[];
|
|
164
|
+
findTetradicDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
153
165
|
/**
|
|
154
166
|
* Find monochromatic dyes (same hue, varying saturation/brightness)
|
|
167
|
+
* @param hex Base hex color
|
|
168
|
+
* @param limit Maximum number of dyes to return (default: 6)
|
|
169
|
+
* @param options Matching algorithm options (optional)
|
|
155
170
|
*/
|
|
156
|
-
findMonochromaticDyes(hex: string, limit?: number): Dye[];
|
|
171
|
+
findMonochromaticDyes(hex: string, limit?: number, options?: HarmonyOptions): Dye[];
|
|
157
172
|
/**
|
|
158
173
|
* Find compound harmony (analogous + complementary)
|
|
174
|
+
* @param hex Base hex color
|
|
175
|
+
* @param options Matching algorithm options (optional)
|
|
159
176
|
*/
|
|
160
|
-
findCompoundDyes(hex: string): Dye[];
|
|
177
|
+
findCompoundDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
161
178
|
/**
|
|
162
179
|
* Find split-complementary harmony (±30° from the complementary hue)
|
|
180
|
+
* @param hex Base hex color
|
|
181
|
+
* @param options Matching algorithm options (optional)
|
|
163
182
|
*/
|
|
164
|
-
findSplitComplementaryDyes(hex: string): Dye[];
|
|
183
|
+
findSplitComplementaryDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
165
184
|
/**
|
|
166
185
|
* Find shades (similar tones, ±15°)
|
|
186
|
+
* @param hex Base hex color
|
|
187
|
+
* @param options Matching algorithm options (optional)
|
|
167
188
|
*/
|
|
168
|
-
findShadesDyes(hex: string): Dye[];
|
|
189
|
+
findShadesDyes(hex: string, options?: HarmonyOptions): Dye[];
|
|
169
190
|
/**
|
|
170
191
|
* Search dyes by name (searches both English + localized names)
|
|
171
192
|
* If no locale is loaded, falls back to English-only search
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DyeService.d.ts","sourceRoot":"","sources":["../../src/services/DyeService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;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AG,EAAE;IAItF;;;;OAIG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAI9D;;;;OAIG;IACH,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAIxE;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,GAAG,EAAE;IAQ5D;;;;;;;;;;;;;OAaG;IACH,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE;IAwB3C;;;;;;;;;;;;;OAaG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAcpD;;;;;;;;;;;;;;OAcG;IACH,mBAAmB,IAAI,YAAY,EAAE;IAarC;;;;;;;;;;;;OAYG;IACH,kBAAkB,IAAI,GAAG,EAAE;CAI5B"}
|
|
@@ -165,58 +165,78 @@ export class DyeService {
|
|
|
165
165
|
// ============================================================================
|
|
166
166
|
/**
|
|
167
167
|
* Find dyes that form a complementary color pair
|
|
168
|
+
* @param hex Base hex color
|
|
169
|
+
* @param options Matching algorithm options (optional)
|
|
168
170
|
*/
|
|
169
|
-
findComplementaryPair(hex) {
|
|
170
|
-
return this.harmony.findComplementaryPair(hex);
|
|
171
|
+
findComplementaryPair(hex, options) {
|
|
172
|
+
return this.harmony.findComplementaryPair(hex, options);
|
|
171
173
|
}
|
|
172
174
|
/**
|
|
173
175
|
* Find analogous dyes (adjacent on color wheel)
|
|
174
176
|
* Returns dyes at ±angle degrees from the base color
|
|
177
|
+
* @param hex Base hex color
|
|
178
|
+
* @param angle Hue offset in degrees (default: 30)
|
|
179
|
+
* @param options Matching algorithm options (optional)
|
|
175
180
|
*/
|
|
176
|
-
findAnalogousDyes(hex, angle = 30) {
|
|
177
|
-
return this.harmony.findAnalogousDyes(hex, angle);
|
|
181
|
+
findAnalogousDyes(hex, angle = 30, options) {
|
|
182
|
+
return this.harmony.findAnalogousDyes(hex, angle, options);
|
|
178
183
|
}
|
|
179
184
|
/**
|
|
180
185
|
* Find triadic color scheme (colors 120° apart on color wheel)
|
|
186
|
+
* @param hex Base hex color
|
|
187
|
+
* @param options Matching algorithm options (optional)
|
|
181
188
|
*/
|
|
182
|
-
findTriadicDyes(hex) {
|
|
183
|
-
return this.harmony.findTriadicDyes(hex);
|
|
189
|
+
findTriadicDyes(hex, options) {
|
|
190
|
+
return this.harmony.findTriadicDyes(hex, options);
|
|
184
191
|
}
|
|
185
192
|
/**
|
|
186
193
|
* Find square color scheme (colors 90° apart on color wheel)
|
|
194
|
+
* @param hex Base hex color
|
|
195
|
+
* @param options Matching algorithm options (optional)
|
|
187
196
|
*/
|
|
188
|
-
findSquareDyes(hex) {
|
|
189
|
-
return this.harmony.findSquareDyes(hex);
|
|
197
|
+
findSquareDyes(hex, options) {
|
|
198
|
+
return this.harmony.findSquareDyes(hex, options);
|
|
190
199
|
}
|
|
191
200
|
/**
|
|
192
201
|
* Find tetradic color scheme (two complementary pairs)
|
|
202
|
+
* @param hex Base hex color
|
|
203
|
+
* @param options Matching algorithm options (optional)
|
|
193
204
|
*/
|
|
194
|
-
findTetradicDyes(hex) {
|
|
195
|
-
return this.harmony.findTetradicDyes(hex);
|
|
205
|
+
findTetradicDyes(hex, options) {
|
|
206
|
+
return this.harmony.findTetradicDyes(hex, options);
|
|
196
207
|
}
|
|
197
208
|
/**
|
|
198
209
|
* Find monochromatic dyes (same hue, varying saturation/brightness)
|
|
210
|
+
* @param hex Base hex color
|
|
211
|
+
* @param limit Maximum number of dyes to return (default: 6)
|
|
212
|
+
* @param options Matching algorithm options (optional)
|
|
199
213
|
*/
|
|
200
|
-
findMonochromaticDyes(hex, limit = 6) {
|
|
201
|
-
return this.harmony.findMonochromaticDyes(hex, limit);
|
|
214
|
+
findMonochromaticDyes(hex, limit = 6, options) {
|
|
215
|
+
return this.harmony.findMonochromaticDyes(hex, limit, options);
|
|
202
216
|
}
|
|
203
217
|
/**
|
|
204
218
|
* Find compound harmony (analogous + complementary)
|
|
219
|
+
* @param hex Base hex color
|
|
220
|
+
* @param options Matching algorithm options (optional)
|
|
205
221
|
*/
|
|
206
|
-
findCompoundDyes(hex) {
|
|
207
|
-
return this.harmony.findCompoundDyes(hex);
|
|
222
|
+
findCompoundDyes(hex, options) {
|
|
223
|
+
return this.harmony.findCompoundDyes(hex, options);
|
|
208
224
|
}
|
|
209
225
|
/**
|
|
210
226
|
* Find split-complementary harmony (±30° from the complementary hue)
|
|
227
|
+
* @param hex Base hex color
|
|
228
|
+
* @param options Matching algorithm options (optional)
|
|
211
229
|
*/
|
|
212
|
-
findSplitComplementaryDyes(hex) {
|
|
213
|
-
return this.harmony.findSplitComplementaryDyes(hex);
|
|
230
|
+
findSplitComplementaryDyes(hex, options) {
|
|
231
|
+
return this.harmony.findSplitComplementaryDyes(hex, options);
|
|
214
232
|
}
|
|
215
233
|
/**
|
|
216
234
|
* Find shades (similar tones, ±15°)
|
|
235
|
+
* @param hex Base hex color
|
|
236
|
+
* @param options Matching algorithm options (optional)
|
|
217
237
|
*/
|
|
218
|
-
findShadesDyes(hex) {
|
|
219
|
-
return this.harmony.findShadesDyes(hex);
|
|
238
|
+
findShadesDyes(hex, options) {
|
|
239
|
+
return this.harmony.findShadesDyes(hex, options);
|
|
220
240
|
}
|
|
221
241
|
// ============================================================================
|
|
222
242
|
// Localization Support (NEW)
|