Siticone Color Picker
The SiticoneColorPicker is a complete color selection widget that provides multiple ways for users to choose colors.
It includes a hue wheel, saturation/brightness box, transparency slider, and direct text input for Hex, RGB, and HSB values.
Color Management
Access and manipulate the selected color in various formats.
| Property | Type | Description |
|---|---|---|
Color |
Color | The currently selected color value as a standard .NET Color structure. |
OldColor |
Color | The color that was selected before the current session or modification. |
ShowOldColor |
bool | Determines if the "Old Color" preview box is visible in the UI. |
Events
Track color changes in real-time or upon completion.
// Fired whenever the selected color changes (e.g., while dragging).
colorPicker.ColorChanged += (s, e) =>
{
// Update a panel in real-time
previewPanel.BackColor = e.Color;
Console.WriteLine($"New Color: {e.Hex} (Alpha: {e.Color.A})");
};
// Fired during interaction to preview the color without committing.
colorPicker.ColorPreview += (s, e) =>
{
// Apply color temporarily
targetControl.ForeColor = e.Color;
};
Designer Support
The control is fully compatible with the Visual Studio designer.
| Category | Features |
|---|---|
Layout |
The control is fixed-size (455x285) to ensure all UI elements fit correctly. |
Initialization |
Automatically sets up child controls (sliders, text boxes) on creation. |
Usage Examples
Example 1: Basic Color Selection
Using the picker to let a user choose a theme color.
private void OpenThemePicker()
{
var pickerForm = new Form();
var picker = new SiticoneColorPicker();
// Set initial color
picker.Color = Properties.Settings.Default.ThemeColor;
picker.ShowOldColor = true;
picker.Dock = DockStyle.Fill;
picker.ColorChanged += (s, e) =>
{
ApplyThemeColor(e.Color);
};
pickerForm.Controls.Add(picker);
pickerForm.ShowDialog();
}
Example 2: Advanced HSB/Hex Access
Retrieving advanced color data from the event arguments.
private void OnColorSelected(object sender, PickerColorChangedEventArgs e)
{
// Access HSB (Hue, Saturation, Brightness) values
Console.WriteLine($"Hue: {e.HSB.H}, Sat: {e.HSB.S}, Bri: {e.HSB.B}");
// Access Hex string directly
txtHexCode.Text = "#" + e.Hex;
// Use the standard Color struct
pnlPreview.BackColor = e.Color;
}