@ankhorage/color-theory 0.0.3 → 0.0.5

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ankhorage/color-theory
2
2
 
3
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - bdb341f: Update docs
8
+ - Update Docs
9
+
10
+ ## 0.0.4
11
+
12
+ ### Patch Changes
13
+
14
+ - c15063e: Add semantic status color seeds and deterministic status swatch generation helpers.
15
+
3
16
  ## 0.0.3
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -1,3 +1,86 @@
1
+ <!-- markdownlint-disable MD013 MD033 -->
2
+ <!-- This file is generated by Paradox. Do not edit manually. -->
3
+
1
4
  # @ankhorage/color-theory
2
5
 
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v0.0.4](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
7
+
3
8
  Standalone color theory, harmony, swatch, contrast, and theme color generation utilities.
9
+
10
+ ## Generated documentation
11
+
12
+ - [Interactive documentation app](././paradox/index.html)
13
+ - [Public API reference](././paradox/exports.md)
14
+ - [Component registry](././paradox/components.md)
15
+ - [Architecture overview](././paradox/diagrams/architecture-overview.mmd)
16
+ - [Module relationships](././paradox/diagrams/module-relationships.mmd)
17
+ - [Export graph](././paradox/diagrams/export-graph.mmd)
18
+ - [assertHexColor sequence](././paradox/diagrams/sequences/assert-hex-color.mmd)
19
+ - [getReadableForeground sequence](././paradox/diagrams/sequences/get-readable-foreground.mmd)
20
+ - [getThemeModePrimaryHex sequence](././paradox/diagrams/sequences/get-theme-mode-primary-hex.mmd)
21
+ - [parseHexColorOrThrow sequence](././paradox/diagrams/sequences/parse-hex-color-or-throw.mmd)
22
+
23
+ ## Architecture preview
24
+
25
+ <details>
26
+ <summary>Architecture overview</summary>
27
+
28
+ ```mermaid
29
+ graph TD
30
+ package__ankhorage_color_theory["@ankhorage/color-theory"]
31
+ entrypoint_src_index_ts["src/index.ts"]
32
+ package__ankhorage_color_theory --> entrypoint_src_index_ts
33
+ module_src_contrast_ts["src/contrast.ts"]
34
+ package__ankhorage_color_theory -.-> module_src_contrast_ts
35
+ module_src_contrast_ts --> module_src_hex_ts
36
+ module_src_contrast_ts --> module_src_internal_culori_ts
37
+ module_src_culori_fn_ts["src/culori-fn.ts"]
38
+ package__ankhorage_color_theory -.-> module_src_culori_fn_ts
39
+ module_src_culori_ts["src/culori.ts"]
40
+ package__ankhorage_color_theory -.-> module_src_culori_ts
41
+ module_src_harmony_ts["src/harmony.ts"]
42
+ package__ankhorage_color_theory -.-> module_src_harmony_ts
43
+ module_src_harmony_ts --> module_src_hex_ts
44
+ module_src_harmony_ts --> module_src_internal_culori_ts
45
+ module_src_hex_ts["src/hex.ts"]
46
+ package__ankhorage_color_theory -.-> module_src_hex_ts
47
+ module_src_index_ts["src/index.ts"]
48
+ module_src_internal_culori_ts["src/internal-culori.ts"]
49
+ package__ankhorage_color_theory -.-> module_src_internal_culori_ts
50
+ module_src_internal_culori_ts --> module_src_hex_ts
51
+ module_src_neutral_ts["src/neutral.ts"]
52
+ package__ankhorage_color_theory -.-> module_src_neutral_ts
53
+ module_src_neutral_ts --> module_src_harmony_ts
54
+ module_src_neutral_ts --> module_src_hex_ts
55
+ module_src_neutral_ts --> module_src_internal_culori_ts
56
+ module_src_neutral_ts --> module_src_swatches_ts
57
+ module_src_semantic_status_ts["src/semantic-status.ts"]
58
+ package__ankhorage_color_theory -.-> module_src_semantic_status_ts
59
+ module_src_semantic_status_ts --> module_src_hex_ts
60
+ module_src_semantic_status_ts --> module_src_swatches_ts
61
+ module_src_semantics_ts["src/semantics.ts"]
62
+ package__ankhorage_color_theory -.-> module_src_semantics_ts
63
+ module_src_semantics_ts --> module_src_harmony_ts
64
+ module_src_semantics_ts --> module_src_swatches_ts
65
+ module_src_swatches_ts["src/swatches.ts"]
66
+ package__ankhorage_color_theory -.-> module_src_swatches_ts
67
+ module_src_swatches_ts --> module_src_hex_ts
68
+ module_src_swatches_ts --> module_src_internal_culori_ts
69
+ module_src_theme_colors_ts["src/theme-colors.ts"]
70
+ package__ankhorage_color_theory -.-> module_src_theme_colors_ts
71
+ module_src_theme_colors_ts --> module_src_harmony_ts
72
+ module_src_theme_colors_ts --> module_src_hex_ts
73
+ module_src_theme_colors_ts --> module_src_neutral_ts
74
+ module_src_theme_colors_ts --> module_src_swatches_ts
75
+ ```
76
+
77
+ </details>
78
+
79
+ ## Path resolution
80
+
81
+ - Config discovery: searches upward from `process.cwd()` for `paradox.config.ts/js/mjs/cjs` (required; no fallback).
82
+ - Package root: defaults to the directory containing `paradox.config.*`; `package.root` (when relative) resolves relative to that directory.
83
+ - Output directory: defaults to `paradox/`; `output.dir` (when relative) resolves relative to the resolved package root and must stay inside it.
84
+ - Modes:
85
+ - `safe`: writes generated artifacts only under the output directory
86
+ - `write`: additionally updates `<packageRoot>/README.md`
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './contrast';
2
2
  export * from './harmony';
3
3
  export * from './hex';
4
4
  export * from './neutral';
5
+ export * from './semantic-status';
5
6
  export * from './semantics';
6
7
  export * from './swatches';
7
8
  export * from './theme-colors';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export * from './contrast';
2
2
  export * from './harmony';
3
3
  export * from './hex';
4
4
  export * from './neutral';
5
+ export * from './semantic-status';
5
6
  export * from './semantics';
6
7
  export * from './swatches';
7
8
  export * from './theme-colors';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './contrast';\nexport * from './harmony';\nexport * from './hex';\nexport * from './neutral';\nexport * from './semantics';\nexport * from './swatches';\nexport * from './theme-colors';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './contrast';\nexport * from './harmony';\nexport * from './hex';\nexport * from './neutral';\nexport * from './semantic-status';\nexport * from './semantics';\nexport * from './swatches';\nexport * from './theme-colors';\n"]}
@@ -0,0 +1,17 @@
1
+ import type { HexColor } from './hex';
2
+ import type { ColorSwatch, ColorSwatchDiagnostics } from './swatches';
3
+ export declare const DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS: {
4
+ readonly danger: "#ef4444";
5
+ readonly success: "#22c55e";
6
+ readonly warning: "#f59e0b";
7
+ };
8
+ export type DefaultSemanticStatusRole = keyof typeof DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS;
9
+ export type SemanticStatusSeedInput = string | HexColor;
10
+ export interface SemanticStatusSwatches<Role extends string> {
11
+ seeds: Record<Role, HexColor>;
12
+ swatches: Record<Role, ColorSwatch>;
13
+ diagnostics: Record<Role, ColorSwatchDiagnostics>;
14
+ }
15
+ export declare function createSemanticStatusSwatches<Role extends string>(seeds: Record<Role, SemanticStatusSeedInput>): SemanticStatusSwatches<Role>;
16
+ export declare function createDefaultSemanticStatusSwatches(): SemanticStatusSwatches<DefaultSemanticStatusRole>;
17
+ //# sourceMappingURL=semantic-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-status.d.ts","sourceRoot":"","sources":["../src/semantic-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGtE,eAAO,MAAM,mCAAmC;;;;CAIL,CAAC;AAE5C,MAAM,MAAM,yBAAyB,GAAG,MAAM,OAAO,mCAAmC,CAAC;AAEzF,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAExD,MAAM,WAAW,sBAAsB,CAAC,IAAI,SAAS,MAAM;IACzD,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;CACnD;AAED,wBAAgB,4BAA4B,CAAC,IAAI,SAAS,MAAM,EAC9D,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,GAC3C,sBAAsB,CAAC,IAAI,CAAC,CAkB9B;AAED,wBAAgB,mCAAmC,IAAI,sBAAsB,CAAC,yBAAyB,CAAC,CAEvG"}
@@ -0,0 +1,26 @@
1
+ import { parseHexColorOrThrow } from './hex';
2
+ import { generateColorSwatch } from './swatches';
3
+ export const DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS = {
4
+ danger: '#ef4444',
5
+ success: '#22c55e',
6
+ warning: '#f59e0b',
7
+ };
8
+ export function createSemanticStatusSwatches(seeds) {
9
+ const roles = Object.keys(seeds);
10
+ const normalizedSeeds = {};
11
+ const swatches = {};
12
+ const diagnostics = {};
13
+ for (const role of roles) {
14
+ const seed = seeds[role];
15
+ const seedHex = typeof seed === 'string' ? parseHexColorOrThrow(seed) : seed;
16
+ normalizedSeeds[role] = seedHex;
17
+ const generated = generateColorSwatch(seedHex);
18
+ swatches[role] = generated.swatch;
19
+ diagnostics[role] = generated.diagnostics;
20
+ }
21
+ return { seeds: normalizedSeeds, swatches, diagnostics };
22
+ }
23
+ export function createDefaultSemanticStatusSwatches() {
24
+ return createSemanticStatusSwatches(DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS);
25
+ }
26
+ //# sourceMappingURL=semantic-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-status.js","sourceRoot":"","sources":["../src/semantic-status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACuB,CAAC;AAY5C,MAAM,UAAU,4BAA4B,CAC1C,KAA4C;IAE5C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAW,CAAC;IAE3C,MAAM,eAAe,GAAG,EAA4B,CAAC;IACrD,MAAM,QAAQ,GAAG,EAA+B,CAAC;IACjD,MAAM,WAAW,GAAG,EAA0C,CAAC;IAE/D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7E,eAAe,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;QAEhC,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC/C,QAAQ,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;QAClC,WAAW,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC;IAC5C,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,mCAAmC;IACjD,OAAO,4BAA4B,CAAC,mCAAmC,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["import type { HexColor } from './hex';\nimport { parseHexColorOrThrow } from './hex';\nimport type { ColorSwatch, ColorSwatchDiagnostics } from './swatches';\nimport { generateColorSwatch } from './swatches';\n\nexport const DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS = {\n danger: '#ef4444',\n success: '#22c55e',\n warning: '#f59e0b',\n} as const satisfies Record<string, string>;\n\nexport type DefaultSemanticStatusRole = keyof typeof DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS;\n\nexport type SemanticStatusSeedInput = string | HexColor;\n\nexport interface SemanticStatusSwatches<Role extends string> {\n seeds: Record<Role, HexColor>;\n swatches: Record<Role, ColorSwatch>;\n diagnostics: Record<Role, ColorSwatchDiagnostics>;\n}\n\nexport function createSemanticStatusSwatches<Role extends string>(\n seeds: Record<Role, SemanticStatusSeedInput>,\n): SemanticStatusSwatches<Role> {\n const roles = Object.keys(seeds) as Role[];\n\n const normalizedSeeds = {} as Record<Role, HexColor>;\n const swatches = {} as Record<Role, ColorSwatch>;\n const diagnostics = {} as Record<Role, ColorSwatchDiagnostics>;\n\n for (const role of roles) {\n const seed = seeds[role];\n const seedHex = typeof seed === 'string' ? parseHexColorOrThrow(seed) : seed;\n normalizedSeeds[role] = seedHex;\n\n const generated = generateColorSwatch(seedHex);\n swatches[role] = generated.swatch;\n diagnostics[role] = generated.diagnostics;\n }\n\n return { seeds: normalizedSeeds, swatches, diagnostics };\n}\n\nexport function createDefaultSemanticStatusSwatches(): SemanticStatusSwatches<DefaultSemanticStatusRole> {\n return createSemanticStatusSwatches(DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS);\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/color-theory",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "description": "Standalone color theory, harmony, swatch, contrast, and theme color generation utilities.",
6
6
  "homepage": "https://github.com/ankhorage/color-theory#readme",
7
7
  "bugs": {
@@ -61,24 +61,24 @@
61
61
  "build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.json",
62
62
  "changeset": "changeset",
63
63
  "changeset:status": "changeset status --since=origin/main",
64
- "knip": "knip",
65
- "lint": "eslint . --max-warnings=0",
66
- "lint:fix": "eslint . --fix --max-warnings=0",
67
- "format": "prettier --write .",
68
- "paradox": "bunx @ankhorage/paradox",
64
+ "knip": "ankhorage-knip",
65
+ "lint": "ankhorage-eslint . --max-warnings=0",
66
+ "lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
67
+ "format": "ankhorage-prettier --write .",
68
+ "format:check": "ankhorage-prettier --check .",
69
+ "docs": "paradox",
69
70
  "prepack": "bun run build",
70
71
  "test": "bun test src",
71
72
  "typecheck": "bun x tsc --noEmit -p tsconfig.json",
72
73
  "version-packages": "changeset version"
73
74
  },
74
75
  "devDependencies": {
75
- "@ankhorage/devtools": "^1.0.1",
76
- "@ankhorage/paradox": "^0.0.3",
76
+ "@ankhorage/devtools": "^1.0.5",
77
+ "@ankhorage/paradox": "^0.1.5",
77
78
  "@changesets/cli": "^2.31.0",
78
79
  "@types/bun": "^1.3.13",
79
80
  "@types/culori": "^4.0.1",
80
81
  "@types/node": "^25.6.0",
81
- "knip": "^5.88.1",
82
82
  "typescript": "^5.9.3"
83
83
  },
84
84
  "packageManager": "bun@1.3.13"