Class ColorPicker
- Namespace
- PluginUI
- Assembly
- PluginUI.dll
HSV color picker: saturation/value square, hue strip, optional alpha strip, hex field, old/new preview and recently used colors. Usually shown in a ColorPickerPopup by a ColorSwatch.
public class ColorPicker : Control
- Inheritance
-
ColorPicker
- Inherited Members
Constructors
ColorPicker()
Creates a picker.
public ColorPicker()
ColorPicker(Color)
Creates a picker showing color.
public ColorPicker(Color color)
Parameters
colorColor
Properties
Color
Selected color.
public Color Color { get; set; }
Property Value
DefaultSize
Natural size used when no explicit size is given.
protected override Size DefaultSize { get; }
Property Value
OriginalColor
Color shown as "before" in the preview (set when the picker opens).
public Color OriginalColor { get; set; }
Property Value
RecentColors
Recently committed colors (shared by all pickers, most recent first).
public static IReadOnlyList<Color> RecentColors { get; }
Property Value
ShowAlpha
Shows and edits the alpha channel.
public bool ShowAlpha { get; set; }
Property Value
VisualChildren
Child elements in drawing order (back to front).
public override IReadOnlyList<UIElement> VisualChildren { get; }
Property Value
Methods
AddRecentColor(Color)
Adds a color to RecentColors.
public static void AddRecentColor(Color color)
Parameters
colorColor
ArrangeOverride(Rect)
Arranges children inside the final bounds.
protected override void ArrangeOverride(Rect bounds)
Parameters
boundsRect
LayoutParts(VectorStyle, out Rect, out Rect, out Rect)
Splits the bounds into label (top), widget and value (bottom) areas according to the style. Override to change the arrangement (e.g. label on the left for sliders).
protected override void LayoutParts(VectorStyle style, out Rect label, out Rect widget, out Rect value)
Parameters
styleVectorStylelabelRectwidgetRectvalueRect
MeasureOverride(Size)
Natural size of the content for the available size (margins excluded).
protected override Size MeasureOverride(Size available)
Parameters
availableSize
Returns
OnCaptureLost()
The mouse capture was lost without a button release.
protected override void OnCaptureLost()
OnKeyDown(KeyEventArgs)
Key pressed while focused (bubbles to parents).
protected override void OnKeyDown(KeyEventArgs e)
Parameters
OnMouseDown(MouseEventArgs)
Mouse button pressed over the element (or captured).
protected override void OnMouseDown(MouseEventArgs e)
Parameters
OnMouseMove(MouseEventArgs)
Mouse moved over the element (or captured).
protected override void OnMouseMove(MouseEventArgs e)
Parameters
OnMouseUp(MouseEventArgs)
Mouse button released.
protected override void OnMouseUp(MouseEventArgs e)
Parameters
RenderVector(DrawingContext, Rect, VectorStyle)
Vector rendering of the widget area.
protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)
Parameters
dcDrawingContextwidgetRectstyleVectorStyle
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Events
ColorChanged
Raised while the user changes the color.
public event Action<ColorPicker, Color>? ColorChanged