[ Close ] Learn more about our custom WordPress development services at htmlBurger


Documentation > Fields > Color


Renders a color picker with an optional palette.

Colors are represented with six hexadecimal digits prefixed with # (e.g. white is #FFFFFF)

Field::make( 'color', 'crb_box_background', 'Background Color' )

Config methods

set_palette( $palette = array() )

Sets the color picker’s pallete of predefined colors. Must be an array of hexadecimal colors.

Field::make( 'color', 'crb_background', 'Background' )
    ->set_palette( array( '#FF0000', '#00FF00', '#0000FF' ) );

Excited about Carbon Fields? Spread the word!