@ankhorage/color-theory 0.0.1 → 0.0.3
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/CHANGELOG.md +15 -0
- package/README.md +2 -0
- package/dist/contrast.d.ts +3 -0
- package/dist/contrast.d.ts.map +1 -1
- package/dist/contrast.js +3 -0
- package/dist/contrast.js.map +1 -1
- package/dist/harmony.d.ts +3 -0
- package/dist/harmony.d.ts.map +1 -1
- package/dist/harmony.js +3 -0
- package/dist/harmony.js.map +1 -1
- package/dist/hex.d.ts +12 -2
- package/dist/hex.d.ts.map +1 -1
- package/dist/hex.js +12 -2
- package/dist/hex.js.map +1 -1
- package/dist/internal-culori.d.ts +17 -12
- package/dist/internal-culori.d.ts.map +1 -1
- package/dist/internal-culori.js +19 -27
- package/dist/internal-culori.js.map +1 -1
- package/dist/neutral.d.ts +3 -0
- package/dist/neutral.d.ts.map +1 -1
- package/dist/neutral.js +9 -0
- package/dist/neutral.js.map +1 -1
- package/dist/swatches.d.ts +3 -0
- package/dist/swatches.d.ts.map +1 -1
- package/dist/swatches.js +9 -0
- package/dist/swatches.js.map +1 -1
- package/dist/theme-colors.d.ts +9 -0
- package/dist/theme-colors.d.ts.map +1 -1
- package/dist/theme-colors.js +9 -0
- package/dist/theme-colors.js.map +1 -1
- package/package.json +3 -4
- package/src/color-theory.test.ts +0 -91
- package/src/contrast.ts +0 -22
- package/src/culori-fn.ts +0 -1
- package/src/culori.ts +0 -1
- package/src/harmony.ts +0 -92
- package/src/hex.ts +0 -29
- package/src/index.ts +0 -7
- package/src/internal-culori.ts +0 -100
- package/src/neutral.ts +0 -68
- package/src/semantics.ts +0 -60
- package/src/swatches.ts +0 -151
- package/src/theme-colors.ts +0 -77
package/src/theme-colors.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { type GeneratedHarmonyRoleColors, generateHarmonyRoleColors } from './harmony';
|
|
2
|
-
import type { HexColor } from './hex';
|
|
3
|
-
import { parseHexColorOrThrow } from './hex';
|
|
4
|
-
import { type GeneratedNeutralMetadata, generateNeutralSwatch } from './neutral';
|
|
5
|
-
import { type ColorSwatch, generateColorSwatch } from './swatches';
|
|
6
|
-
|
|
7
|
-
export interface ThemeModeColorInput {
|
|
8
|
-
primaryColor: string;
|
|
9
|
-
harmony: GeneratedHarmonyRoleColors['harmony'];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ThemeColorInput {
|
|
13
|
-
light: ThemeModeColorInput;
|
|
14
|
-
dark: ThemeModeColorInput;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface GeneratedThemeSwatches {
|
|
18
|
-
primary: ColorSwatch;
|
|
19
|
-
secondary?: ColorSwatch;
|
|
20
|
-
tertiary?: ColorSwatch;
|
|
21
|
-
quaternary?: ColorSwatch;
|
|
22
|
-
neutral: ColorSwatch;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface GeneratedThemeModeColors {
|
|
26
|
-
harmonyRoleColors: GeneratedHarmonyRoleColors;
|
|
27
|
-
swatches: GeneratedThemeSwatches;
|
|
28
|
-
neutral: GeneratedNeutralMetadata;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getThemeModePrimaryHex(mode: ThemeModeColorInput): HexColor {
|
|
32
|
-
return parseHexColorOrThrow(mode.primaryColor);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function generateThemeModeColors(mode: ThemeModeColorInput): GeneratedThemeModeColors {
|
|
36
|
-
const primaryHex = getThemeModePrimaryHex(mode);
|
|
37
|
-
const harmonyRoleColors = generateHarmonyRoleColors(primaryHex, mode.harmony);
|
|
38
|
-
|
|
39
|
-
const primarySwatch = generateColorSwatch(harmonyRoleColors.primary.hex).swatch;
|
|
40
|
-
const secondarySwatch = harmonyRoleColors.secondary
|
|
41
|
-
? generateColorSwatch(harmonyRoleColors.secondary.hex).swatch
|
|
42
|
-
: undefined;
|
|
43
|
-
const tertiarySwatch = harmonyRoleColors.tertiary
|
|
44
|
-
? generateColorSwatch(harmonyRoleColors.tertiary.hex).swatch
|
|
45
|
-
: undefined;
|
|
46
|
-
const quaternarySwatch = harmonyRoleColors.quaternary
|
|
47
|
-
? generateColorSwatch(harmonyRoleColors.quaternary.hex).swatch
|
|
48
|
-
: undefined;
|
|
49
|
-
|
|
50
|
-
const neutral = generateNeutralSwatch(harmonyRoleColors);
|
|
51
|
-
const swatches: GeneratedThemeSwatches = {
|
|
52
|
-
primary: primarySwatch,
|
|
53
|
-
neutral: neutral.neutral,
|
|
54
|
-
...(secondarySwatch ? { secondary: secondarySwatch } : {}),
|
|
55
|
-
...(tertiarySwatch ? { tertiary: tertiarySwatch } : {}),
|
|
56
|
-
...(quaternarySwatch ? { quaternary: quaternarySwatch } : {}),
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
harmonyRoleColors,
|
|
61
|
-
swatches,
|
|
62
|
-
neutral: {
|
|
63
|
-
neutralKeyColor: neutral.neutralKeyColor,
|
|
64
|
-
diagnostics: neutral.diagnostics,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function generateThemeColors(theme: ThemeColorInput): {
|
|
70
|
-
light: GeneratedThemeModeColors;
|
|
71
|
-
dark: GeneratedThemeModeColors;
|
|
72
|
-
} {
|
|
73
|
-
return {
|
|
74
|
-
light: generateThemeModeColors(theme.light),
|
|
75
|
-
dark: generateThemeModeColors(theme.dark),
|
|
76
|
-
};
|
|
77
|
-
}
|