adobe / leonardo

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

Update docs #239

Closed GarthDB closed 5 months ago

GarthDB commented 5 months ago

Description

There were some broken examples in the "Leonardo JS API" page.

Motivation

Previously, this was the example code on the site has this code which doesn't work:

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'};

I changed it to this:

// Change the colors ratios
theme.updateColor = {color: 'red', ratios: [3, 4.5, 7]};

// Change the colors colorKeys
theme.updateColor = {color: 'red', colorKeys: ['#ff0000']};

// Change the color's name
theme.updateColor = {color: 'red', name: 'Crimson'};

I also added this, (which helps #229 ).

// It's also possible to change the color name and colorKeys in the same function
theme.updateColor = {color: 'red', ratios: [3, 4.5, 7], colorKeys: ['#ff0000'], name: 'Crimson'};

To-do list

changeset-bot[bot] commented 5 months ago

⚠️ No Changeset found

Latest commit: 0de1e1858b905f7af7617f65f3986b586e729d59

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

GarthDB commented 5 months ago

Run report for 0de1e185

Total time: 19.1s Comparison time: 17.7s Estimated loss: 1.3s (7.0% slower) Action Time Status Info
🟩 SyncWorkspace 0ms Passed
⬛️ SetupNodeTool(~20.11) 1.2s Skipped
🟩 InstallNodeDeps(~20.11) 8.4s Passed
🟩 SyncNodeProject(contrast-colors) 0.2ms Passed
🟩 SyncNodeProject(ui) 0.3ms Passed
🟩 RunTask(ui:makeDistDir) 32.3ms Passed
🟩 RunTask(ui:copyCNAME) 55.7ms Passed
🟩 RunTask(ui:copyUIIcons) 55.7ms Passed
🟩 RunTask(ui:copyWorkflowIcons) 39.5ms Passed
🟩 RunTask(ui:buildSite) 9.4s Passed
Touched files
``` .changeset/config.json docs/ui/src/views/home_gettingStarted.html ```