Skip to main content

Overview

Flowery.Uno provides a complete suite of color picker controls that work together to create rich color selection experiences. All controls support HSL and RGB color spaces, automatic theme integration, and accessibility features.
All color picker controls support automatic font scaling when contained within a FloweryScaleManager.EnableScaling="True" container.

Color Picker Controls

DaisyColorWheel

A circular color wheel for selecting hue and saturation values. The wheel displays colors in HSL color space with a draggable marker.
<colorpicker:DaisyColorWheel
    x:Name="ColorWheel"
    Width="200"
    Height="200"
    Color="Red"
    Lightness="0.5"
    ColorChanged="OnColorChanged" />

How It Works

The wheel renders a bitmap where:
  • Angle = Hue (0-359°)
  • Distance from center = Saturation (0-1)
  • Lightness is fixed at the Lightness property value
Drag the marker to select a color, or use keyboard navigation for precise control.

Example: Linked Lightness Slider

<StackPanel Spacing="12">
    <colorpicker:DaisyColorWheel
        x:Name="ColorWheel"
        Width="200"
        Height="200"
        Lightness="{x:Bind LightnessSlider.Value, Mode=OneWay}" />
    
    <colorpicker:DaisyColorSlider
        x:Name="LightnessSlider"
        Channel="Lightness"
        Color="{x:Bind ColorWheel.Color, Mode=TwoWay}"
        Height="20" />
</StackPanel>

DaisyColorGrid

A grid control for displaying and selecting colors from a palette. Supports custom color collections and auto-add functionality.
<colorpicker:DaisyColorGrid
    x:Name="ColorGrid"
    Palette="Paint"
    ShowCustomColors="True"
    AutoAddColors="True"
    ColorChanged="OnColorChanged" />

Example: Custom Palette

var myPalette = new ColorCollection();
myPalette.Add(Colors.Red);
myPalette.Add(Colors.Green);
myPalette.Add(Colors.Blue);

ColorGrid.Palette = myPalette;

Keyboard Navigation

  • Arrow Keys: Navigate cells
  • Home/End: Jump to first/last color
  • Enter/Space: Select current cell

DaisyColorSlider

A slider control for selecting individual color channel values (RGB, HSL, Alpha).
<StackPanel Spacing="6">
    <colorpicker:DaisyColorSlider
        Channel="Red"
        Color="{x:Bind MyColor, Mode=TwoWay}"
        Height="18" />
    
    <colorpicker:DaisyColorSlider
        Channel="Green"
        Color="{x:Bind MyColor, Mode=TwoWay}"
        Height="18" />
    
    <colorpicker:DaisyColorSlider
        Channel="Blue"
        Color="{x:Bind MyColor, Mode=TwoWay}"
        Height="18" />
    
    <colorpicker:DaisyColorSlider
        Channel="Alpha"
        Color="{x:Bind MyColor, Mode=TwoWay}"
        Height="18"
        ShowCheckerboard="True" />
</StackPanel>

Channel Types

public enum ColorSliderChannel
{
    Red,         // 0-255
    Green,       // 0-255
    Blue,        // 0-255
    Alpha,       // 0-255
    Hue,         // 0-359
    Saturation,  // 0-100
    Lightness    // 0-100
}

Vertical Orientation

<colorpicker:DaisyColorSlider
    Channel="Hue"
    Orientation="Vertical"
    Width="20"
    Height="200" />

DaisyColorEditor

A comprehensive color editor with RGB/HSL sliders and numeric inputs. This is the most feature-complete picker control.
<colorpicker:DaisyColorEditor
    x:Name="ColorEditor"
    Color="{x:Bind ViewModel.SelectedColor, Mode=TwoWay}"
    ShowHexInput="True"
    ShowRgbSliders="True"
    ShowHslSliders="True"
    ShowAlphaChannel="True" />

Features

  • Dual mode: RGB and HSL sliders with synchronized updates
  • Hex input: Supports 6-digit (#RRGGBB) and 8-digit (#AARRGGBB) formats
  • Numeric inputs: DaisyNumericUpDown for precise value entry
  • Auto-sync: All controls automatically sync when any value changes

Example: Compact Color Editor

<Border BorderBrush="{ThemeResource DaisyBase300Brush}"
        BorderThickness="1"
        Padding="8">
    <colorpicker:DaisyColorEditor
        Color="{x:Bind MyColor, Mode=TwoWay}"
        ShowHexInput="True"
        ShowRgbSliders="True"
        ShowHslSliders="False"
        ShowAlphaChannel="False" />
</Border>

DaisyScreenColorPicker

A control for picking colors from anywhere on the screen using an eyedropper tool (Windows only).
DaisyScreenColorPicker uses Win32 APIs and only works on Windows. On other platforms, it displays but does not capture screen colors.
<colorpicker:DaisyScreenColorPicker
    x:Name="ScreenPicker"
    Color="{x:Bind ViewModel.PickedColor, Mode=TwoWay}"
    PickingCompleted="OnPickingCompleted" />

How to Use

1

Click and hold

Click on the screen picker control and hold the mouse button.
2

Drag anywhere

Drag the cursor anywhere on the screen. The preview updates in real-time.
3

Release to pick

Release the mouse button to pick the color under the cursor.
4

Escape to cancel

Press Escape to cancel the pick operation.

Display

The control shows:
  • Color preview with checkerboard background for transparency
  • Hex value (#RRGGBB)
  • RGB values (R:nnn G:nnn B:nnn)
  • Status text (“Click and drag to pick” / “Release to pick”)
  • Eyedropper icon (hidden while capturing)

HSL Color Space

All color picker controls support HSL (Hue, Saturation, Lightness) color space alongside RGB.

HslColor Struct

public struct HslColor
{
    public int A { get; set; }      // Alpha (0-255)
    public double H { get; set; }   // Hue (0-359)
    public double S { get; set; }   // Saturation (0-1)
    public double L { get; set; }   // Lightness (0-1)
    
    // Constructors
    public HslColor(double hue, double saturation, double lightness);
    public HslColor(int alpha, double hue, double saturation, double lightness);
    public HslColor(Color color);
    
    // Conversion
    public Color ToRgbColor();
    public Color ToRgbColor(int alpha);
}

HSL ↔ RGB Conversion

// RGB to HSL
var rgbColor = Colors.Red;
var hslColor = new HslColor(rgbColor);
Console.WriteLine($"H={hslColor.H}, S={hslColor.S}, L={hslColor.L}");

// HSL to RGB
var hsl = new HslColor(120, 1.0, 0.5); // Green
var rgb = hsl.ToRgbColor();

// Implicit conversion
Color color = new HslColor(240, 1.0, 0.5); // Blue
HslColor hsl2 = Colors.Yellow;

Integration Patterns

Complete Color Picker Dialog

Combine multiple controls for a comprehensive color picker:
<StackPanel Spacing="12" Padding="12">
    <!-- Wheel + Lightness -->
    <Grid ColumnSpacing="12">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        
        <colorpicker:DaisyColorWheel
            x:Name="ColorWheel"
            Grid.Column="0"
            Width="200"
            Height="200"
            Lightness="{x:Bind LightnessSlider.Value, Mode=OneWay}"
            Color="{x:Bind SelectedColor, Mode=TwoWay}" />
        
        <colorpicker:DaisyColorSlider
            x:Name="LightnessSlider"
            Grid.Column="1"
            Channel="Lightness"
            Orientation="Vertical"
            Width="20"
            Height="200"
            Color="{x:Bind SelectedColor, Mode=TwoWay}" />
    </Grid>
    
    <!-- Editor -->
    <colorpicker:DaisyColorEditor
        Color="{x:Bind SelectedColor, Mode=TwoWay}" />
    
    <!-- Palette -->
    <colorpicker:DaisyColorGrid
        Color="{x:Bind SelectedColor, Mode=TwoWay}"
        Height="120" />
    
    <!-- Screen Picker -->
    <colorpicker:DaisyScreenColorPicker
        Color="{x:Bind SelectedColor, Mode=TwoWay}" />
</StackPanel>

Theme-Based Color Picker

Bind to DaisyUI theme colors:
<StackPanel Spacing="8">
    <TextBlock Text="Select Theme Color" />
    
    <colorpicker:DaisyColorGrid
        ColorChanged="OnThemeColorChanged">
        <colorpicker:DaisyColorGrid.Palette>
            <colorpicker:ColorCollection>
                <Color>{ThemeResource DaisyPrimaryColor}</Color>
                <Color>{ThemeResource DaisySecondaryColor}</Color>
                <Color>{ThemeResource DaisyAccentColor}</Color>
                <Color>{ThemeResource DaisyInfoColor}</Color>
                <Color>{ThemeResource DaisySuccessColor}</Color>
                <Color>{ThemeResource DaisyWarningColor}</Color>
                <Color>{ThemeResource DaisyErrorColor}</Color>
            </colorpicker:ColorCollection>
        </colorpicker:DaisyColorGrid.Palette>
    </colorpicker:DaisyColorGrid>
</StackPanel>

Custom Color with Callback

<colorpicker:DaisyColorWheel
    Width="200"
    Height="200"
    OnColorChanged="{x:Bind UpdateBackgroundColor}" />
private void UpdateBackgroundColor(Color color)
{
    MyPanel.Background = new SolidColorBrush(color);
}

Accessibility

All color picker controls support:
  • Keyboard navigation with arrow keys, Home/End, Page Up/Down
  • Focus visuals using UseSystemFocusVisuals="True"
  • Screen reader support via AutomationProperties.Name
  • Custom accessible text via AccessibleText property
<colorpicker:DaisyColorWheel
    AccessibleText="Background color picker"
    IsTabStop="True"
    UseSystemFocusVisuals="True" />

Best Practices

HSL is ideal for color manipulation (brightness, saturation adjustments) while RGB is better for precise channel control.
Pair DaisyColorWheel with sliders for the most intuitive color selection.
Set ShowAlphaChannel="True" on DaisyColorEditor and use DaisyColorSlider with Channel="Alpha" for transparency support.
Provide users with common color presets using DaisyColorGrid with a custom palette.
Bind all controls to the same Color property with Mode=TwoWay for automatic synchronization.

Build docs developers (and LLMs) love