Skip to content

ColorPicker Class

Displays a rectangle gradient area between SadRogue.Primitives.Color.Black and a target color, and SadRogue.Primitives.Color.White and a target color.

C#
public class ColorPicker : ControlBase

Inheritance objectControlBase

Creates a new panel with the specified width, height, and master color.

C#
public ColorPicker(int width, int height, Color color)

width int

height int

color SadRogue.Primitives.Color

The color selected by the user. A shade of MasterColor.

C#
public Color SelectedColor { get; }

The main color being shown that all gradients are generated from.

C#
public Color MasterColor { get; set; }

Called as the mouse moves around the control area. Raises the MouseMove event and calls the DetermineState() method.

C#
protected override void OnMouseIn(ControlBase.ControlMouseState info)

info ControlBase.ControlMouseState

Checks if the mouse is the control and calls the appropriate mouse methods.

C#
public override bool ProcessMouse(MouseScreenObjectState info)

info MouseScreenObjectState

bool
True when the control is enabled, set to use the mouse and the mouse is over it, otherwise false.

Redraws the control if applicable.

C#
public override void UpdateAndRedraw(TimeSpan time)

time TimeSpan
The duration of thecurrent frame.

Raised when SelectedColor changes value.

C#
public event EventHandler? SelectedColorChanged

EventHandler