Skip to content

feat: add colorSpace as canonical name, deprecate colorspace (non-breaking)#264

Merged
GarthDB merged 9 commits intomainfrom
feat/colorspace-to-colorSpace-deprecation-alias
Feb 18, 2026
Merged

feat: add colorSpace as canonical name, deprecate colorspace (non-breaking)#264
GarthDB merged 9 commits intomainfrom
feat/colorspace-to-colorSpace-deprecation-alias

Conversation

@GarthDB
Copy link
Copy Markdown
Member

@GarthDB GarthDB commented Feb 18, 2026

Replaces colorspace with colorSpace for consistency (fixes #190) without a breaking change.

Approach: deprecation alias

  • Color / BackgroundColor: Constructor and updateColor accept both colorspace and colorSpace; colorSpace takes precedence. New colorSpace getter/setter; colorspace kept as deprecated alias with console.warn.
  • createScale: Same: accept both param names, prefer colorSpace, warn when colorspace is used.
  • TypeScript: colorSpace added to ColorBase and createScale options; colorspace marked @deprecated.
  • docs/ui: Uses colorSpace in config, URL serialization, and internal scale classes. URL config parsing supports both keys for backward compatibility.

Existing code continues to work; a future major can remove the deprecated form.

Supersedes the approach in PR #191 (which was a breaking rename); this PR implements the deprecation-alias strategy commented on that PR.

Made with Cursor

…aking)

- Accept both colorspace and colorSpace in Color/Theme/createScale; prefer colorSpace
- Add colorSpace getter/setter; keep colorspace as deprecated alias with console.warn
- Theme.updateColor accepts param.colorSpace ?? param.colorspace
- TypeScript: add colorSpace to types, @deprecated colorspace
- docs/ui: use colorSpace in config, URL serialization, and internal classes
- URL config parsing supports both keys for backward compatibility

Refs #190, supersedes approach in PR #191 (deprecation alias avoids breaking change).

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 18, 2026

🦋 Changeset detected

Latest commit: f6ac136

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@adobe/leonardo-contrast-colors Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

GarthDB and others added 4 commits February 17, 2026 17:37
Co-authored-by: Cursor <cursoragent@cursor.com>
…utParameters.js

Co-authored-by: Cursor <cursoragent@cursor.com>
- Fix convertColorValue return type: overloads for object=true
  (Record<string, number>) vs default (string)
- Fix createScale return type: overloads for asFun=true (Scale) vs
  default (CssColor[])
- Export consumer-facing types: CssColor, Colorspace, CreateScaleOptions,
  etc.
- Add chroma-js.d.ts shim for type-checking without @types/chroma-js
- Add tsd and test/index.test-d.ts to lock return types and prevent
  regressions
- Add moon test-types task for CI

Co-authored-by: Cursor <cursoragent@cursor.com>
Use continue-on-error for moonrepo/run-report-action so missing or
invalid MOON_GH_TOKEN (e.g. on fork PRs) does not mark the job failed.

Co-authored-by: Cursor <cursoragent@cursor.com>
@GarthDB GarthDB force-pushed the feat/colorspace-to-colorSpace-deprecation-alias branch from c87d5b1 to fd57eeb Compare February 18, 2026 00:58
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 18, 2026

Run report for f6ac136c

Total time: 15.1s | Comparison time: 28.4s | Estimated savings: 13.3s (46.8% faster)

Action Time Status Info
⬛️ SetupProto(0.53.2) 0.1ms Skipped
🟩 SyncWorkspace 7.9ms Passed
🟩 SyncProject(contrast-colors) 0.3ms Passed
🟩 SyncProject(ui) 0.3ms Passed
🟩 RunTask(ui:makeDistDir) 128ms Passed
🟩 RunTask(ui:copyCNAME) 17.8ms Passed
⬛️ SetupToolchain(node:24.0.0) 1.4s Skipped
🟩 InstallWorkspaceDeps(node:24.0.0) 0.4ms Passed
🟩 RunTask(ui:copyUIIcons) 36.8ms Passed
🟩 RunTask(ui:copyWorkflowIcons) 66.5ms Passed
🟩 RunTask(ui:lint) 3.8s Passed
🟩 RunTask(contrast-colors:test-types) 7s Passed
🟩 RunTask(contrast-colors:test) 7.2s Passed
🟩 RunTask(ui:buildSite) 13.6s Passed
Touched files
.changeset/colorSpace-deprecation-alias.md
.github/workflows/ci.yml
docs/ui/moon.yml
docs/ui/src/demo.js
docs/ui/src/js/addColorsFromImage.js
docs/ui/src/js/colorDetailsPanel.js
docs/ui/src/js/colorScale.js
docs/ui/src/js/colorScaleDiverging.js
docs/ui/src/js/colorScaleSequential.js
docs/ui/src/js/createOutputParameters.js
docs/ui/src/js/createPaletteCharts.js
docs/ui/src/js/initialDivergingScale.js
docs/ui/src/js/initialSequentialScale.js
docs/ui/src/js/initialTheme.js
docs/ui/src/js/params.js
docs/ui/src/theme.js
package.json
packages/contrast-colors/chroma-js.d.ts
packages/contrast-colors/index.d.ts
packages/contrast-colors/lib/color.js
packages/contrast-colors/lib/theme.js
packages/contrast-colors/lib/utils.js
packages/contrast-colors/moon.yml
packages/contrast-colors/package.json
packages/contrast-colors/test/index.test-d.ts
pnpm-lock.yaml

GarthDB and others added 4 commits February 17, 2026 18:02
- Run moon ci with tee to save full output to moon-ci.log
- Upload moon-ci.log artifact when job fails for debugging
- Use GITHUB_TOKEN for run-report-action instead of MOON_GH_TOKEN

Co-authored-by: Cursor <cursoragent@cursor.com>
…puts

- CI: use GITHUB_TOKEN, run pnpm install --frozen-lockfile before moon ci,
  upload moon-ci.log on failure, continue-on-error for run-report
- Moon: use @group() instead of @globs() for task inputs/outputs so
  contrast-colors literal sources are hashed and cache invalidates correctly

Co-authored-by: Cursor <cursoragent@cursor.com>
…colors

Co-authored-by: Cursor <cursoragent@cursor.com>
- Use colorSpace (not colorspace) in Color._generateColorScale to avoid
  spamming deprecation warning on every scale regeneration
- Use colorSpaceVal in params.js OKLAB/OKLCH smoothing check so URL
  configs with old colorspace key still enable first-color smoothing
- Add console.warn in theme.js updateColor when deprecated colorspace
  key is used (consistent with Color constructor/setter)
- Fix Output error message to reference this._output not colorSpace

Co-authored-by: Cursor <cursoragent@cursor.com>
@GarthDB
Copy link
Copy Markdown
Member Author

GarthDB commented Feb 18, 2026

Follow-up bug fixes (pushed to this branch)

A few issues in the deprecation-alias implementation were fixed in commit f6ac136:

  1. Color._generateColorScale — It was still passing colorspace to createScale(), which triggered the deprecation warning on every scale regeneration. Updated to pass colorSpace so internal calls don’t spam the console.

  2. docs/ui params.js — The OKLAB/OKLCH smoothing check used color.colorSpace only, so URL configs that used the old colorspace key (e.g. bookmarks) skipped first-color smoothing. It now uses the normalized colorSpaceVal (color.colorSpace ?? color.colorspace).

  3. Theme updateColor — When the deprecated colorspace key was passed, it was aliased without a warning. Added a console.warn when colorspace is used so it’s consistent with the Color constructor/setter.

  4. Color constructor — The unsupported-output error message referenced colorSpace instead of this._output; corrected so the message shows the actual invalid output value.

The index.d.ts changes in this PR (canonical colorSpace and @deprecated colorspace) already match this behavior; no type changes were needed in the follow-up.

@GarthDB
Copy link
Copy Markdown
Member Author

GarthDB commented Feb 18, 2026

The changes to the index.d.ts and tests are also satisfy the original intent of the #102 pr.

@GarthDB GarthDB merged commit 7385295 into main Feb 18, 2026
3 checks passed
@GarthDB GarthDB deleted the feat/colorspace-to-colorSpace-deprecation-alias branch February 18, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"colorSpace" key does not work when written in camel-case

1 participant