Skip to main content

Color Picker Widget

⚡ Control

The Color Picker widget presents a color wheel or HEX input that sends an RGB color to a virtual pin. Aimed at controlling addressable LEDs (WS2812B/NeoPixels), RGB LED strips, or any device that accepts color data.

Default size: 2 × 2 grid cells


Configuration

PropertyTypeDefaultDescription
formathex | rgb | inthexOutput format sent to device
DevicedeviceThe device to write to
PinV0V255The virtual pin to write
LabelstringWidget label

Output formats

formatExample sent to pin
hex"#FF6600"
rgb"255,102,0"
int16737792 (0xFFFFFF packed)

Firmware examples

HEX format (simplest)

VWIRE_RECEIVE(V0) {
String hex = param.asStr(); // "#FF6600"
hex.remove(0, 1); // strip '#' → "FF6600"
long color = strtol(hex.c_str(), NULL, 16);

int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;

strip.fill(strip.Color(r, g, b));
strip.show();
}

RGB format

VWIRE_RECEIVE(V0) {
String raw = param.asStr(); // "255,102,0"
int r, g, b;
sscanf(raw.c_str(), "%d,%d,%d", &r, &g, &b);

analogWrite(RED_PIN, r);
analogWrite(GREEN_PIN, g);
analogWrite(BLUE_PIN, b);
}

Integer (packed 24-bit)

VWIRE_RECEIVE(V0) {
long color = param.asLong(); // 16737792
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;

neopixel.setPixelColor(0, r, g, b);
neopixel.show();
}

Tips

Throttle updates

Color picker changes can fire many events as the user drags the hue wheel. The widget includes a short debounce, but your device should also use analogWrite smoothly rather than blocking operations on each color event.