openColorSelector
Prompts the user to choose a color that can be used within Canva.
Parameters
anchor
Anchor
RequiredA bounding box.
height
number
RequiredThe height of the bounding box, in pixels.
width
number
RequiredThe width of the bounding box, in pixels.
top
number
RequiredThe top position of the bounding box, in pixels.
left
number
RequiredThe left position of the bounding box, in pixels.
options
ColorSelectorOpts<Scope>
RequiredOptions for configuring a color selector.
scopes
Scope[]
RequiredThe supported scopes, used to determine the appearance and behavior of the color selector.
This must be "solid"
.
onColorSelect
function
RequiredA callback that runs when the user selects a color.
Parameters
event
ColorSelectionEvent<Scope>
RequiredThe color selection event.
selection
object
RequiredThe selected color.
The exact properties depends on the configured scope
.
Returns
void
selectedColor
object
OptionalThe color to display as selected when the color selector is opened.
This is only required if there are multiple UI components for selecting colors.
For example, if the app renders multiple Swatch
components.
If this value is undefined
, the most recently selected color will be displayed as selected.
This property only affects Document colors and Default colors.
Returns
A function that closes the currently open color selector.
Promise<() => void>