-
Notifications
You must be signed in to change notification settings - Fork 124
backgroundcolor.js is using depreciated colorspace #280
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When using @adobe/leonardo-contrast-colors, deprecation warnings are printed repeatedly:
Leonardo: `colorspace` is deprecated. Use `colorSpace` instead.
This happens even when the caller uses the non-deprecated colorSpace API. The warning is emitted internally by the library during background scale generation.
Steps to Reproduce
- Install
@adobe/leonardo-contrast-colors(version below). - Run a minimal script that instantiates
BackgroundColor/Themeand accesses generated values, or run your theme generation.
Minimal Node repro:
import { Theme, Color, BackgroundColor } from '@adobe/leonardo-contrast-colors';
const bg = new BackgroundColor({
name: 'bg',
colorKeys: ['#111111'],
ratios: [2, 3, 4.5, 8],
colorSpace: 'LCH',
});
const fg = new Color({
name: 'fg',
colorKeys: ['#ffffff'],
ratios: [4.5],
colorSpace: 'LCH',
});
const theme = new Theme({
colors: [bg, fg],
backgroundColor: bg,
lightness: 20,
});
console.log(theme.contrastColors);Expected Behavior
No deprecation warnings should be emitted when callers use colorSpace.
Actual Behavior
The library prints the deprecation warning many times during scale generation.
Package and Version
- Package:
@adobe/leonardo-contrast-colors - Version:
1.1.0
Environment
- OS: Linux
Root Cause
The warning is produced inside the Leonardo package itself:
lib/utils.jswarns whencreateScale()receives acolorspaceargument:createScale({ ..., colorspace, colorSpace = ... }) // logs warning when colorspace !== undefined
lib/backgroundcolor.jscallscreateScale()with the deprecated key:createScale({ ..., colorspace: this._colorspace, ... })
So even though the caller's code uses colorSpace, the library internally forwards colorspace and triggers the warning spam.
Proposed Fix
Update lib/backgroundcolor.js to pass colorSpace (camelCase) to createScale() instead of colorspace:
- colorspace: this._colorspace,
+ colorSpace: this._colorspace,Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working