adobe / leonardo

Generate colors based on a desired contrast ratio
http://www.leonardocolor.io
Apache License 2.0
1.96k stars 107 forks source link

Improve typescript return types #102

Open fedeci opened 4 years ago

fedeci commented 4 years ago

Description

Types returned from 'generateAdaptiveTheme' and 'fixColorValue' now are variable depending on a generic parameter. eg.

// color will be of type 'string',
// while before it would have been of type 'string | { [key: string]: number }'
const color = fixColorValue('#2c66f1', 'HSL', false)

This closes #99

Motivation

This helps the user to better understand what the function will return.

Screenshots

To-do list