> ## Documentation Index > Fetch the complete documentation index at: https://www.canva.dev/docs/apps/llms.txt > Use this file to discover all available pages before exploring further. # openColorSelector API reference for the openColorSelector method. Opens a color selector. ## Usage ### Open a color selector ```typescript import { type Anchor, openColorSelector } from "@canva/asset"; const anchor: Anchor = { width: 200, height: 40, top: 100, left: 100 }; await openColorSelector(anchor, { scopes: ["solid"], onColorSelect: (event) => { if (event.selection.type === "solid") { const color = event.selection.hexString; } } }); ``` ### Open a color selector with a pre-selected color ```typescript import { type Anchor, type SolidColor, openColorSelector } from "@canva/asset"; const anchor: Anchor = { width: 200, height: 40, top: 100, left: 100 }; const preselectedColor: SolidColor = { type: "solid", hexString: "#ff0000" }; await openColorSelector(anchor, { scopes: ["solid"], selectedColor: preselectedColor, onColorSelect: (event) => { if (event.selection.type === "solid") { const color = event.selection.hexString; } } }); ``` ### Close a color selector programmatically ```typescript import { type Anchor, openColorSelector } from "@canva/asset"; const anchor: Anchor = { width: 200, height: 40, top: 100, left: 100 }; const close = await openColorSelector(anchor, { scopes: ["solid"], onColorSelect: (event) => { if (event.selection.type === "solid") { const color = event.selection.hexString; } } }); // Later: Close the color selector close(); ``` ## Parameters A bounding box. Properties of anchor}> The height of the bounding box, in pixels. The width of the bounding box, in pixels. The top position of the bounding box, in pixels. The left position of the bounding box, in pixels. Options for configuring a color selector. Properties of options}> The supported scopes, used to determine the appearance and behavior of the color selector. The only valid value is `"solid"`. A callback that runs when the user selects a color. **Parameters** The color selection event. Properties of event}> The selected color. The exact properties depends on the configured `scope`. Properties of selection}> The type of color. The only valid value is `"solid"`. The color as a hexadecimal code. This is always a 6-digit code that's prefixed with a `#` symbol. **Example** ```ts "#ff0099" ``` **Returns** `void` The 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**. Properties of selectedColor}> The type of color. The only valid value is `"solid"`. The color as a hexadecimal code. This is always a 6-digit code that's prefixed with a `#` symbol. **Example** ```ts "#ff0099" ``` ## Returns A function that closes the currently open color selector. `Promise<() => void>` ## Permissions To use this method, the following permissions must be enabled for the app: * `canva:design:content:read` * `canva:brandkit:read` To learn more, see [Permissions](https://www.canva.dev/docs/apps/configuring-intents-permissions/).