Skip to main content
Color widgets provide an intuitive way for users to select and edit colors. Dear ImGui offers both inline color editors and full picker popups.

Color Edit Widgets

ColorEdit3()

Edit RGB color (3 components):
const char*
required
Widget label
float[3]
required
RGB color array (values 0.0 to 1.0)

ColorEdit4()

Edit RGBA color (4 components with alpha):
ColorEdit widgets display a colored square that can be:
  • Left-clicked to open a color picker
  • Right-clicked to open options menu
  • Ctrl+Clicked on components to input values directly

Color Picker Widgets

ColorPicker3() / ColorPicker4()

Full-featured color picker:
const float*
Optional reference color to display for comparison

Color Button

ColorButton()

Display a colored square button:

Color Edit Flags

Customize color widget behavior with flags:

Display Mode Flags

Picker Mode Flags

Alpha Flags

Interaction Flags

Custom Color Picker Popup

Create a custom picker popup with palette:

Color Palette

Create a palette of saved colors:

Color Conversion Utilities

Set Color Edit Options

Set default options for all color widgets:

Complete Example

HDR Colors

Enable HDR mode to allow values beyond 0.0-1.0 range:
With ImGuiColorEditFlags_HDR, the color components can go beyond the normal 0.0-1.0 range, useful for emission colors or bloom effects.

Best Practices

Use ImGuiColorEditFlags_NoAlpha when you only need RGB colors without transparency.
ColorEdit returns true every frame the color is being edited. Check the return value only if you need to respond to changes.
Enable drag and drop between color widgets automatically unless you specify ImGuiColorEditFlags_NoDragDrop.