-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Typescript support #90
Conversation
Thank you for this contribution @fedeci ! |
You're welcome! |
FYI this feature added to release 1.0.0-alpha.7 |
is it possible to create an interface for the const uiRatios = [1, 1.5, 2, 2.5, 3, 4.5, 7, 11, 16];
const redScale: ColorScales = {
name: 'red',
ratios: uiRatios,
colorKeys: [],
colorspace: 'HEX'
}
const blueScale: ColorScales = {
name: 'blue',
ratios: uiRatios,
colorKeys: [],
colorspace: 'HEX'
}
generateAdaptiveTheme({
colorScales: [redScale, blueScale],
baseScale: "red"
}) for now I'm just extending the import '@adobe/leonardo-contrast-colors';
declare module '@adobe/leonardo-contrast-colors' {
export interface ColorScales {
name: string;
colorKeys: string[];
colorspace: Colorspace;
ratios: number[] | { [key: string]: number };
}
} btw really great work, impressive !! |
and there is an issue with the type Colorspace = 'CAM02' | 'CAM02p' | 'LCH' | 'LAB' | 'HSL' | 'HSLuv' | 'RGB' | 'HSV' | 'HEX'; HEX provides an issue. then rn I'm good with : import '@adobe/leonardo-contrast-colors';
declare module '@adobe/leonardo-contrast-colors' {
export type ColorScales = {
name: string;
colorKeys: string[];
colorspace: Exclude<Colorspace, 'HEX'>;
ratios: number[] | { [key: string]: number };
};
} |
Thx ! Next time time should I create an issue ? |
If the PR has already been merged it is better to create an issue. 👍 |
* feat: add Typescript support * feat: update index.d.ts
Description
This pull request adds index.d.ts file to provide typescript type information about contrast-colors module.
This closes #74
Motivation
This simplify the use of the module in typescript projects.
Screenshots
To-do list