You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please note that Adobe Express uses the terms **make** and **create** to distinguish between plain objects and live document objects. You `makeColorFill()`, but `createEllipse()`.
131
+
132
+
## Use the Color Picker
133
+
134
+
Adobe Express includes a native Color Picker, with special features such as Recommended Swatches, Eyedropper, Themes, Library and Brand colors. The Color Picker is available also to add-ons, you can invoke it using the [`addOnUISdk.app.showColorPicker()`](../../../references/addonsdk/addonsdk-app.md#showcolorpicker) method.
135
+
136
+
#### Benefits
137
+
138
+
- It simplifies the process of selecting a color, bypassing the Browser's color picker.
139
+
- It's in sync with any swatches or Brand colors defined in Adobe Express.
140
+
- It will evolve with Adobe Express, providing a consistent color picking experience across different parts of the application.
141
+
142
+
The `showColorPicker()` method accepts a reference to an HTML element as its first argument, which will become the color picker's anchor element. The picker will be positioned relative to this element, based on the placement options available in the `ColorPickerPlacement` enum; additionally, the anchor will receive a custom `"colorpicker-color-change"` event when the color changes and a `"colorpicker-close"` event when it is closed.
143
+
144
+
The `showColorPicker()` method requires an HTML element as its anchor point. Here's how it works:
145
+
146
+
1.**Anchor Element**
147
+
148
+
- Pass an HTML element reference as the first argument.
149
+
- The color picker will position itself relative to this element.
150
+
- Use the `ColorPickerPlacement` enum to control positioning.
151
+
152
+
2.**Event Handling**
153
+
154
+
- The anchor element receives two custom events:
155
+
-`"colorpicker-color-change"`: Fires when a new color is selected.
156
+
-`"colorpicker-close"`: Fires when the picker is closed.
<buttonid="colorPicker">Show the Color Picker</button>
208
+
```
209
+
210
+
Please note that the color returned by the `colorpicker-color-change` event is always a string in HEX format—with or without an alpha value, e.g., `#F0EDD8FF` or `#F0EDD8` depending on the `disableAlphaChannel` option.
211
+
212
+
### Example: Hide the Color Picker
213
+
214
+
You can decide to hide picker UI e.g., after a certain amount of time.
To use the picked color in the Document Sandbox, you can use the [`colorUtils.fromHex()`](../../../references/document-sandbox/document-apis/classes/ColorUtils.md#fromhex) method, which converts the HEX color string to a [`Color`](../../../references/document-sandbox/document-apis/interfaces/Color.md) object.
273
+
274
+
```js
275
+
// sandbox/code.js
276
+
constcolor=colorUtils.fromHex(event.detail.color); // 👈 A Color object
277
+
278
+
// Use the color in the Document Sandbox, for example:
279
+
let selection =editor.context.selection;
280
+
if (selection.length===1&& selection[0].type==="Text") {
281
+
consttextContentModel= selection[0].fullContent;
282
+
textContentModel.applyCharacterStyles({ color }); // 👈 Using the color
This command will create a new add-on based on pure JavaScript with Document Sandbox support (the set of APIs that allow you to interact with Adobe Express documents).
@@ -71,13 +71,13 @@ Please run this command to clear the `npx` cache and ensure the latest version o
71
71
72
72
```bash
73
73
npx clear-npx-cache
74
-
npx @adobe/create-ccweb-add-on hello-world
74
+
npx @adobe/create-ccweb-add-on hello-world
75
75
```
76
76
77
77
The above may prove useful when updated versions of the CLI are released. If you want to read each individual CLI command manual page, run them via `npx` with the `--help` flag, for example:
78
78
79
79
```bash
80
-
npx @adobe/ccweb-add-on-scripts start --help
80
+
npx @adobe/ccweb-add-on-scripts start --help
81
81
```
82
82
83
83
## Step 2: Build and start your add-on
@@ -134,9 +134,9 @@ For simplicity's sake, this Quickstart guide covers the document creation method
134
134
135
135
- Once clicked, a modal will appear where you will provide the URL of your locally hosted add-on.
136
136
137
-
**Note:** Use the default `https://localhost:5241` supplied unless you are intentionally using a different port.
137
+
**Note:** Use the default `https://localhost:5241` supplied unless you are intentionally using a different port.
138
138
139
-
Select the *I understand the risks of loading an add-on from an external server* checkbox and press the **Connect** button.
139
+
Select the _I understand the risks of loading an add-on from an external server_ checkbox and press the **Connect** button.
@@ -170,7 +170,7 @@ You can continue to update your code while your add-on is running, and the add-o
170
170
171
171
**Manifest updates**<br/>
172
172
173
-
Any changes to the `manifest.json` will *require a manual reload of your add-on*. The **Add-on Development** panel will indicate this in the log messages, and the **Refresh** button can be used to reload the add-on directly within Adobe Express. You can try this by updating the `name` field in the `src/manifest.json` file of your running add-on from "Hello World" to, say, **"Draw Rectangle"**.
173
+
Any changes to the `manifest.json` will _require a manual reload of your add-on_. The **Add-on Development** panel will indicate this in the log messages, and the **Refresh** button can be used to reload the add-on directly within Adobe Express. You can try this by updating the `name` field in the `src/manifest.json` file of your running add-on from "Hello World" to, say, **"Draw Rectangle"**.
|`title?`|`string`| Label header/title for the color picker. Default value: `""`|
277
+
|`initialColor?`|`number`| Default/starting color when you open the color picker for the first time on a `anchorElement`. When you have already changed the color with this picker, then the next time you open the picker, the last selected color will be the starting color. Default: `0xFFFFFF` (white) |
278
+
|`placement?`|`object`[ColorPickerPlacement](./addonsdk-constants.md#constants)| Placement of the popover with respect to the anchor element (default: `"left"`). |
279
+
|`eyedropperHidesPicker?`|`boolean`| Closes the color picker popover while using the EyeDropper. After the color is selected via the EyeDropper, the color picker popup opens again. Default: `false`. |
280
+
|`disableAlphaChannel?`|`boolean`| Disables the transparency slider in the "custom" section of the color picker. Default: `false`. |
console.log("Hiding Color Picker after 10 seconds...");
331
+
addOnUISdk.app.hideColorPicker();
332
+
}, 10000);
333
+
});
334
+
```
335
+
257
336
### registerIframe()
258
337
259
338
Allows an iframe hosted within an add-on to register its intent to communicate with the add-on SDK. While iframes can be used for embedding media without SDK interaction, `registerIframe()` is needed for those requiring SDK capabilities. It marks a transition to a more controlled approach, where add-ons must explicitly opt-in to this level of integration.
Copy file name to clipboardexpand all lines: src/pages/references/changelog.md
+9
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,15 @@ contributors:
22
22
23
23
# Changelog
24
24
25
+
## 2025-03-21
26
+
27
+
### Added
28
+
29
+
- A native Color Picker is available to add-ons via the [`showColorPicker()`](../references/addonsdk/addonsdk-app.md#showcolorpicker) and [`hideColorPicker()`](../references/addonsdk/addonsdk-app.md#hidecolorpicker) methods of the `addOnUiSdk.app` object.
30
+
- We've updated the [Use Color](../guides/develop/how_to/use_color.md) How-to guide, now including a few examples on the Color Picker.
31
+
- A [new section](../references/ui-components/color-picker.md) has been added to the documentation, which provides a reference for the Adobe Express built-in UI components available to add-ons, like the Color Picker.
32
+
- A new version of the `@adobe/ccweb-add-on-sdk-types` package (v1.14.0) has been released for the CLI. Run `npm update` from the root of your add-on project to update to get the latest typings.
0 commit comments