Typescript: missing interface for colorScales parameter of generateAdaptiveTheme function
fedeci opened this issue · comments
Description
colorScales
parameter type of generateAdaptiveTheme
should became a separated interface to simplify the use of the function when working in a typescript project.
function generateAdaptiveTheme({
colorScales,
...
}: {
colorScales: {
name: string,
colorKeys: string[],
colorspace: InterpolationColorspace,
ratios: number[] | { [key: string]: number },
smooth?: boolean
}[],
...
}): AdaptiveTheme | never;
Why do you need this feature?
example of the advantage of using a separate interface:
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"
})
Leonardo package and version
@leonardo-contrast-colors version: 1.0.0-alpha.7
Additional context
More info at #90