Skip to content
Block Controls

Color Picker

Color picker control lets users select colors from a predefined palette or choose custom colors with optional opacity.

Color Picker Control

Control Settings

  • Alongside Text (alongside_text) - text printed beside the color indicator. Empty by default
  • Alpha Channel (alpha) - off by default. On, the picker adds an opacity slider and stores rgba values
  • Color Palette (palette) - on by default. Shows the theme's own color palette above the picker. Off, the picker offers no swatches
  • Output Format (output_format) - Color by default, which stores the color on its own. Array (Color + Slug) stores the color together with the palette slug

Usage

PHP
<p style="color: <?php echo esc_attr( $attributes['control_name'] ); ?>">
  Text with custom color using inline css.
</p>
PHP with Output Format as Array
<p style="color: <?php echo esc_attr( $attributes['control_name']['color'] ); ?>">
  Text with custom color using inline css.
</p>
 
<p class="color-<?php echo esc_attr( $attributes['control_name']['slug'] ); ?>">
  Text with custom color using classname.
</p>
Handlebars
<p style="color: {{control_name}}">
  {{text}}
</p>
Handlebars with Output Format as Array
<p style="color: {{control_name.color}}">
  {{text}}
</p>
<p class="color-{{control_name.slug}}">
  {{text}}
</p>
Post Meta
<p style="color: <?php echo esc_attr( get_lzb_meta( 'control_meta_name' ) ); ?>">
  Text with custom color.
</p>

Was this article helpful?

Copyright © 2026 Lazy Blocks.