@ankhorage/color-theory 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ankhorage/color-theory
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a4068c6: Add a canonical informational status seed and generated swatch independent of brand harmony.
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Minor Changes
@@ -2,6 +2,7 @@ import type { HexColor } from './hex';
2
2
  import type { ColorSwatch, ColorSwatchDiagnostics } from './swatches';
3
3
  export declare const DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS: {
4
4
  readonly danger: "#ef4444";
5
+ readonly info: "#3b82f6";
5
6
  readonly success: "#22c55e";
6
7
  readonly warning: "#f59e0b";
7
8
  };
@@ -1 +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;AAmCD;;EAEE;AACF,wBAAgB,4BAA4B,CAAC,IAAI,SAAS,MAAM,EAC9D,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,GAC3C,sBAAsB,CAAC,IAAI,CAAC,CAS9B;AAED;;EAEE;AACF,wBAAgB,mCAAmC,IAAI,sBAAsB,CAAC,yBAAyB,CAAC,CAEvG"}
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;;;;;CAKL,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;AAmCD;;EAEE;AACF,wBAAgB,4BAA4B,CAAC,IAAI,SAAS,MAAM,EAC9D,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,GAC3C,sBAAsB,CAAC,IAAI,CAAC,CAS9B;AAED;;EAEE;AACF,wBAAgB,mCAAmC,IAAI,sBAAsB,CAAC,yBAAyB,CAAC,CAEvG"}
@@ -2,6 +2,7 @@ import { parseHexColorOrThrow } from './hex';
2
2
  import { generateColorSwatch } from './swatches';
3
3
  export const DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS = {
4
4
  danger: '#ef4444',
5
+ info: '#3b82f6',
5
6
  success: '#22c55e',
6
7
  warning: '#f59e0b',
7
8
  };
@@ -1 +1 @@
1
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,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/E,WAAW,EAAE,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;KAC7F,CAAC;AACJ,CAAC;AAED;;EAEE;AACF,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\ninterface GeneratedSemanticStatus<Role extends string> {\n readonly diagnostics: ColorSwatchDiagnostics;\n readonly role: Role;\n readonly seed: HexColor;\n readonly swatch: ColorSwatch;\n}\n\n/***\n Convert typed entries into a role-keyed immutable result record.\n*/\nfunction createRoleRecord<Role extends string, Value>(\n entries: readonly (readonly [Role, Value])[],\n): Record<Role, Value> {\n return Object.fromEntries(entries) as Record<Role, Value>;\n}\n\n/***\n Normalize and generate one semantic status role.\n*/\nfunction generateSemanticStatus<Role extends string>(\n role: Role,\n seed: SemanticStatusSeedInput,\n): GeneratedSemanticStatus<Role> {\n const seedHex = typeof seed === 'string' ? parseHexColorOrThrow(seed) : seed;\n const generated = generateColorSwatch(seedHex);\n return {\n role,\n seed: seedHex,\n swatch: generated.swatch,\n diagnostics: generated.diagnostics,\n };\n}\n\n/***\n Generate semantic status swatches from a role-to-seed record.\n*/\nexport function createSemanticStatusSwatches<Role extends string>(\n seeds: Record<Role, SemanticStatusSeedInput>,\n): SemanticStatusSwatches<Role> {\n const generated = Object.entries(seeds).map(([role, seed]) =>\n generateSemanticStatus(role as Role, seed as SemanticStatusSeedInput),\n );\n return {\n seeds: createRoleRecord(generated.map(({ role, seed }) => [role, seed])),\n swatches: createRoleRecord(generated.map(({ role, swatch }) => [role, swatch])),\n diagnostics: createRoleRecord(generated.map(({ diagnostics, role }) => [role, diagnostics])),\n };\n}\n\n/***\n Generate the canonical default semantic status swatches.\n*/\nexport function createDefaultSemanticStatusSwatches(): SemanticStatusSwatches<DefaultSemanticStatusRole> {\n return createSemanticStatusSwatches(DEFAULT_SEMANTIC_STATUS_COLOR_SEEDS);\n}\n"]}
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,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACuB,CAAC;AAmB5C;;EAEE;AACF,SAAS,gBAAgB,CACvB,OAA4C;IAE5C,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAwB,CAAC;AAC5D,CAAC;AAED;;EAEE;AACF,SAAS,sBAAsB,CAC7B,IAAU,EACV,IAA6B;IAE7B,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,WAAW,EAAE,SAAS,CAAC,WAAW;KACnC,CAAC;AACJ,CAAC;AAED;;EAEE;AACF,MAAM,UAAU,4BAA4B,CAC1C,KAA4C;IAE5C,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAC3D,sBAAsB,CAAC,IAAY,EAAE,IAA+B,CAAC,CACtE,CAAC;IACF,OAAO;QACL,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACxE,QAAQ,EAAE,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/E,WAAW,EAAE,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;KAC7F,CAAC;AACJ,CAAC;AAED;;EAEE;AACF,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 info: '#3b82f6',\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\ninterface GeneratedSemanticStatus<Role extends string> {\n readonly diagnostics: ColorSwatchDiagnostics;\n readonly role: Role;\n readonly seed: HexColor;\n readonly swatch: ColorSwatch;\n}\n\n/***\n Convert typed entries into a role-keyed immutable result record.\n*/\nfunction createRoleRecord<Role extends string, Value>(\n entries: readonly (readonly [Role, Value])[],\n): Record<Role, Value> {\n return Object.fromEntries(entries) as Record<Role, Value>;\n}\n\n/***\n Normalize and generate one semantic status role.\n*/\nfunction generateSemanticStatus<Role extends string>(\n role: Role,\n seed: SemanticStatusSeedInput,\n): GeneratedSemanticStatus<Role> {\n const seedHex = typeof seed === 'string' ? parseHexColorOrThrow(seed) : seed;\n const generated = generateColorSwatch(seedHex);\n return {\n role,\n seed: seedHex,\n swatch: generated.swatch,\n diagnostics: generated.diagnostics,\n };\n}\n\n/***\n Generate semantic status swatches from a role-to-seed record.\n*/\nexport function createSemanticStatusSwatches<Role extends string>(\n seeds: Record<Role, SemanticStatusSeedInput>,\n): SemanticStatusSwatches<Role> {\n const generated = Object.entries(seeds).map(([role, seed]) =>\n generateSemanticStatus(role as Role, seed as SemanticStatusSeedInput),\n );\n return {\n seeds: createRoleRecord(generated.map(({ role, seed }) => [role, seed])),\n swatches: createRoleRecord(generated.map(({ role, swatch }) => [role, swatch])),\n diagnostics: createRoleRecord(generated.map(({ diagnostics, role }) => [role, diagnostics])),\n };\n}\n\n/***\n Generate the canonical default semantic status swatches.\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.2.0",
4
+ "version": "0.3.0",
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": {