Developers · Gutenberg

Color Thief block for WordPress

Upload an image to automatically extract its dominant color palette using canvas pixel analysis.

Get Blockenberg

Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.

Get Blockenberg

What it actually does

Upload an image to automatically extract its dominant color palette using canvas pixel analysis.

Inspector panels on this block: Image, Palette Settings, Swatch Appearance, Color Labels. Those titles come from index.js, not from a shared template.

Behavior controls: “Object Fit” options: Cover, Contain, Fill; “Sampling Quality” (Lower = more accurate, slower); “Layout” options: Row (flex), Grid, List; “Copy Format” options: HEX (#rrggbb), RGB, HSL.

Where to find it

Gutenberg inserter → Developers → search “Color Thief” (block name `blockenberg/color-thief` in block.json). Style it in the sidebar after insert.

How to use Color Thief block for WordPress

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “Color Thief”, insert it. Category: Developers.
  3. Configure inspector controls that exist on this block. Open Image. Set “Show Image Preview”, “Preview Height (px)”, “Object Fit”, “Number of Colors”.
  4. Check the published page. The view script reads HTML data attributes: data-opts. The block editor preview may not run the same view script.

Inspector controls from this block’s code

ControlWhat the code does
Show Image PreviewOn/off toggle in the inspector. On by default. Saved as `showImagePreview`.
Preview Height (px)Numeric range control in the inspector. Range 80–600. block.json default: 200. Saved as `imageHeight`.
Object FitSelect control; the chosen value is saved on the block. Options: Cover; Contain; Fill. block.json default: cover. Saved as `imageObjectFit`.
Number of ColorsNumeric range control in the inspector. Range 2–12. block.json default: 6. Saved as `paletteSize`.
Sampling QualityNumeric range control in the inspector. Lower = more accurate, slower. Range 1–20. block.json default: 10. Saved as `quality`.
Show Dominant Color BannerOn/off toggle in the inspector. On by default. Saved as `showDominant`.
LayoutSelect control; the chosen value is saved on the block. Options: Row (flex); Grid; List. block.json default: row. Saved as `layout`.
Grid ColumnsNumeric range control in the inspector. Range 2–12. block.json default: 6. Saved as `swatchColumns`.
Swatch Size (px)Numeric range control in the inspector. Range 24–150. block.json default: 60. Saved as `swatchSize`.
Corner Radius (px)Numeric range control in the inspector. Range 0–60. block.json default: 8. Saved as `swatchRadius`.
Gap (px)Numeric range control in the inspector. Range 2–40. block.json default: 8. Saved as `swatchGap`.
Show Copy ButtonOn/off toggle in the inspector. On by default. Saved as `showCopyButton`.
Copy FormatSelect control; the chosen value is saved on the block. Options: HEX (#rrggbb); RGB; HSL. block.json default: hex. Saved as `copyFormat`.
Show HEX ValuesOn/off toggle in the inspector. On by default. Saved as `showHexValues`.
Show RGB ValuesOn/off toggle in the inspector. Off by default. Saved as `showRgbValues`.
Show HSL ValuesOn/off toggle in the inspector. Off by default. Saved as `showHslValues`.
LabelShared Blockenberg typography popover (family, size, weight, spacing). Saved as `typoLabel`.
Block Border Radius (px)Numeric range control in the inspector. Range 0–40. block.json default: 12. Saved as `borderRadius`.
Padding (px)Numeric range control in the inspector. Range 0–60. block.json default: 20. Saved as `padding`.
Colors — BackgroundColor control in the inspector. block.json default: #ffffff. Saved as `bgColor`.
Label TextColor control in the inspector. block.json default: #374151. Saved as `labelColor`.
Colors — BorderColor control in the inspector. block.json default: #e5e7eb. Saved as `borderColor`.

What the front-end script actually does

When this is the right block

Notes from the implementation

viewScript: this folder’s frontend.js is enqueued on the front end for this block.

FAQ

How do I add the Color Thief block in WordPress?

Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Color Thief”. It sits under Developers. After insert, open Image and set “Show Image Preview”, “Preview Height (px)”, “Object Fit”, “Number of Colors”.

What makes Color Thief different from other Blockenberg blocks?

Upload an image to automatically extract its dominant color palette using canvas pixel analysis. Inspector labels on this block include “Show Image Preview”, “Preview Height (px)”, “Object Fit”, “Number of Colors”.

Is the Color Thief Gutenberg block free?

Yes. Color Thief ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.

Can I style Color Thief to match my theme?

Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Image, Palette Settings, Swatch Appearance, Color Labels).

Related developers blocks

Get Blockenberg

Install Blockenberg from WordPress.org, then insert Color Thief from the Gutenberg inserter.

Get Blockenberg