Leonardo JS API documentation explains the update function as
Theme.updateColor = {name, property}
`const red = new Color({...})
// Change the colors ratios
theme.updateColor = {name: 'red', ratios: [3, 4.5, 7]};
// Change the colors colorKeys
theme.updateColor = {name: 'red', colorKeys: ['#ff0000']};
// Change the color's name
theme.updateColor = {name: 'red', name: 'Crimson'};`
However, theme.js definition of updateColor uses color: "red" to filter (and to find) the color, and name:"blue" to change the name of the color.
Steps to reproduce
Create a theme
Update color & name of the new color in the theme theme.updateColor = {color: 'blue' name: 'red', colorKeys: ['#ff0000'] };
`
This will find the color with the name blue, and update its name & value at the same time. The documentation is not wrong, however I (and some other developers) found it confusing when filtering from an external function. I think extending the update definition may clarify. I found the definition at theme.js to be more helpful.
Expected behavior
The documentation should explain this capability. I think the theme.js should stay as is, as many projects are probably already consuming it. It makes more sense to update the documentation. There's a comment in theme.js which explains how this function should be used.
Description
Leonardo JS API documentation explains the update function as Theme.updateColor = {name, property}
`const red = new Color({...}) // Change the colors ratios theme.updateColor = {name: 'red', ratios: [3, 4.5, 7]};
However, theme.js definition of updateColor uses
color: "red"
to filter (and to find) the color, andname:"blue"
to change the name of the color.Steps to reproduce
theme.updateColor = {color: 'blue' name: 'red', colorKeys: ['#ff0000'] };
` This will find the color with the name blue, and update its name & value at the same time. The documentation is not wrong, however I (and some other developers) found it confusing when filtering from an external function. I think extending the update definition may clarify. I found the definition at theme.js to be more helpful.Expected behavior
The documentation should explain this capability. I think the theme.js should stay as is, as many projects are probably already consuming it. It makes more sense to update the documentation. There's a comment in theme.js which explains how this function should be used.
Screenshots
Leonardo package and version
leonardocolor.io website
Environment
MacOS
Additional context