# ColorSpectrum

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls-color-picker/primitives/struct-colorspectrum/

**struct** · [`ferroui-controls-color-picker`](/docs/0.5.0/api/ferroui-controls-color-picker/) · v0.5.0

```rust
struct ColorSpectrum
```

A two dimensional spectrum for color selection.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L38)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`PC_PRESSED`](#assoc_const-pc_pressed)
- [`PC_DARK_SELECTOR`](#assoc_const-pc_dark_selector)
- [`PC_LARGE_SELECTOR`](#assoc_const-pc_large_selector)
- [`PC_LIGHT_SELECTOR`](#assoc_const-pc_light_selector)
- [`TEMPLATE_PARTS`](#assoc_const-template_parts)
- [`PSEUDO_CLASSES`](#assoc_const-pseudo_classes)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`color_changed`](#function-color_changed)
- [`raise_color_changed`](#function-raise_color_changed)
- [`color_property`](#function-color_property)
- [`components_property`](#function-components_property)
- [`hsv_color_property`](#function-hsv_color_property)
- [`max_hue_property`](#function-max_hue_property)
- [`max_saturation_property`](#function-max_saturation_property)
- [`max_value_property`](#function-max_value_property)
- [`min_hue_property`](#function-min_hue_property)
- [`min_saturation_property`](#function-min_saturation_property)
- [`min_value_property`](#function-min_value_property)
- [`shape_property`](#function-shape_property)
- [`third_component_property`](#function-third_component_property)
- [`color`](#function-color)
- [`set_color`](#function-set_color)
- [`components`](#function-components)
- [`set_components`](#function-set_components)
- [`hsv_color`](#function-hsv_color)
- [`set_hsv_color`](#function-set_hsv_color)
- [`max_hue`](#function-max_hue)
- [`set_max_hue`](#function-set_max_hue)
- [`max_saturation`](#function-max_saturation)
- [`set_max_saturation`](#function-set_max_saturation)
- [`max_value`](#function-max_value)
- [`set_max_value`](#function-set_max_value)
- [`min_hue`](#function-min_hue)
- [`set_min_hue`](#function-set_min_hue)
- [`min_saturation`](#function-min_saturation)
- [`set_min_saturation`](#function-set_min_saturation)
- [`min_value`](#function-min_value)
- [`set_min_value`](#function-set_min_value)
- [`shape`](#function-shape)
- [`set_shape`](#function-set_shape)
- [`third_component`](#function-third_component)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L100)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<ColorSpectrum>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L100)

<a id="assoc_const-pc_pressed"></a>

### PC_PRESSED

```rust
const PC_PRESSED: &'static str
```

The pseudo-class of a pressed spectrum.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L553)

<a id="assoc_const-pc_dark_selector"></a>

### PC_DARK_SELECTOR

```rust
const PC_DARK_SELECTOR: &'static str
```

The pseudo-class of a dark selection ellipse.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L555)

<a id="assoc_const-pc_large_selector"></a>

### PC_LARGE_SELECTOR

```rust
const PC_LARGE_SELECTOR: &'static str
```

The pseudo-class of a large selection ellipse.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L557)

<a id="assoc_const-pc_light_selector"></a>

### PC_LIGHT_SELECTOR

```rust
const PC_LIGHT_SELECTOR: &'static str
```

The pseudo-class of a light selection ellipse.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L559)

<a id="assoc_const-template_parts"></a>

### TEMPLATE_PARTS

```rust
const TEMPLATE_PARTS: &'static [TemplatePartAttribute]
```

The named parts expected in the control template.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L562)

<a id="assoc_const-pseudo_classes"></a>

### PSEUDO_CLASSES

```rust
const PSEUDO_CLASSES: PseudoClassesAttribute
```

The pseudo-classes set by the class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L574)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L582)

<a id="function-new"></a>

### new

```rust
fn new() -> Ref<Self>
```

Initializes a new instance of the `ColorSpectrum` class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L630)

<a id="function-color_changed"></a>

### color_changed

```rust
fn color_changed(self: &Self, handler: impl Fn(&ColorChangedEventArgs) -> () + 'static) -> Rc<dyn IDisposable>
```

Event for when the selected color changes within the spectrum.
Disposing the returned handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L647)

<a id="function-raise_color_changed"></a>

### raise_color_changed

```rust
fn raise_color_changed(self: &Self)
```

Raises the color changed event when the color differs from the last
one reported.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum.rs#L694)

<a id="function-color_property"></a>

### color_property

```rust
fn color_property() -> &'static StyledProperty<Color>
```

Defines the `Color` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-components_property"></a>

### components_property

```rust
fn components_property() -> &'static StyledProperty<ColorSpectrumComponents>
```

Defines the `Components` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-hsv_color_property"></a>

### hsv_color_property

```rust
fn hsv_color_property() -> &'static StyledProperty<HsvColor>
```

Defines the `HsvColor` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-max_hue_property"></a>

### max_hue_property

```rust
fn max_hue_property() -> &'static StyledProperty<i32>
```

Defines the `MaxHue` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-max_saturation_property"></a>

### max_saturation_property

```rust
fn max_saturation_property() -> &'static StyledProperty<i32>
```

Defines the `MaxSaturation` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-max_value_property"></a>

### max_value_property

```rust
fn max_value_property() -> &'static StyledProperty<i32>
```

Defines the `MaxValue` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-min_hue_property"></a>

### min_hue_property

```rust
fn min_hue_property() -> &'static StyledProperty<i32>
```

Defines the `MinHue` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-min_saturation_property"></a>

### min_saturation_property

```rust
fn min_saturation_property() -> &'static StyledProperty<i32>
```

Defines the `MinSaturation` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-min_value_property"></a>

### min_value_property

```rust
fn min_value_property() -> &'static StyledProperty<i32>
```

Defines the `MinValue` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-shape_property"></a>

### shape_property

```rust
fn shape_property() -> &'static StyledProperty<ColorSpectrumShape>
```

Defines the `Shape` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-third_component_property"></a>

### third_component_property

```rust
fn third_component_property() -> &'static DirectProperty<ColorSpectrum, ColorComponent>
```

Defines the `ThirdComponent` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L13)

<a id="function-color"></a>

### color

```rust
fn color(self: &Self) -> Color
```

Gets the currently selected color in the RGB color model.

For control authors, use `hsv_color` instead to avoid loss
of precision and color drifting.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L109)

<a id="function-set_color"></a>

### set_color

```rust
fn set_color(self: &Self, value: Color)
```

Sets `color`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L114)

<a id="function-components"></a>

### components

```rust
fn components(self: &Self) -> ColorSpectrumComponents
```

Gets the two HSV color components displayed by the spectrum.

Internally, the `ColorSpectrum` uses the HSV color model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L121)

<a id="function-set_components"></a>

### set_components

```rust
fn set_components(self: &Self, value: ColorSpectrumComponents)
```

Sets `components`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L126)

<a id="function-hsv_color"></a>

### hsv_color

```rust
fn hsv_color(self: &Self) -> HsvColor
```

Gets the currently selected color in the HSV color model.

This should be used in all cases instead of the `color` property.
Internally, the `ColorSpectrum` uses the HSV color model and using
this property will avoid loss of precision and color drifting.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L135)

<a id="function-set_hsv_color"></a>

### set_hsv_color

```rust
fn set_hsv_color(self: &Self, value: HsvColor)
```

Sets `hsv_color`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L140)

<a id="function-max_hue"></a>

### max_hue

```rust
fn max_hue(self: &Self) -> i32
```

Gets the maximum value of the Hue component in the range from 0..359.
This property must be greater than `min_hue`.

Internally, the `ColorSpectrum` uses the HSV color model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L148)

<a id="function-set_max_hue"></a>

### set_max_hue

```rust
fn set_max_hue(self: &Self, value: i32)
```

Sets `max_hue`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L153)

<a id="function-max_saturation"></a>

### max_saturation

```rust
fn max_saturation(self: &Self) -> i32
```

Gets the maximum value of the Saturation component in the range from 0..100.
This property must be greater than `min_saturation`.

Internally, the `ColorSpectrum` uses the HSV color model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L161)

<a id="function-set_max_saturation"></a>

### set_max_saturation

```rust
fn set_max_saturation(self: &Self, value: i32)
```

Sets `max_saturation`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L166)

<a id="function-max_value"></a>

### max_value

```rust
fn max_value(self: &Self) -> i32
```

Gets the maximum value of the Value component in the range from 0..100.
This property must be greater than `min_value`.

Internally, the `ColorSpectrum` uses the HSV color model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L174)

<a id="function-set_max_value"></a>

### set_max_value

```rust
fn set_max_value(self: &Self, value: i32)
```

Sets `max_value`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L179)

<a id="function-min_hue"></a>

### min_hue

```rust
fn min_hue(self: &Self) -> i32
```

Gets the minimum value of the Hue component in the range from 0..359.
This property must be less than `max_hue`.

Internally, the `ColorSpectrum` uses the HSV color model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L187)

<a id="function-set_min_hue"></a>

### set_min_hue

```rust
fn set_min_hue(self: &Self, value: i32)
```

Sets `min_hue`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L192)

<a id="function-min_saturation"></a>

### min_saturation

```rust
fn min_saturation(self: &Self) -> i32
```

Gets the minimum value of the Saturation component in the range from 0..100.
This property must be less than `max_saturation`.

Internally, the `ColorSpectrum` uses the HSV color model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L200)

<a id="function-set_min_saturation"></a>

### set_min_saturation

```rust
fn set_min_saturation(self: &Self, value: i32)
```

Sets `min_saturation`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L205)

<a id="function-min_value"></a>

### min_value

```rust
fn min_value(self: &Self) -> i32
```

Gets the minimum value of the Value component in the range from 0..100.
This property must be less than `max_value`.

Internally, the `ColorSpectrum` uses the HSV color model.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L213)

<a id="function-set_min_value"></a>

### set_min_value

```rust
fn set_min_value(self: &Self, value: i32)
```

Sets `min_value`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L218)

<a id="function-shape"></a>

### shape

```rust
fn shape(self: &Self) -> ColorSpectrumShape
```

Gets the displayed shape of the spectrum.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L223)

<a id="function-set_shape"></a>

### set_shape

```rust
fn set_shape(self: &Self, value: ColorSpectrumShape)
```

Sets `shape`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L228)

<a id="function-third_component"></a>

### third_component

```rust
fn third_component(self: &Self) -> ColorComponent
```

Gets the third HSV color component that is NOT displayed by the spectrum.
This is automatically calculated from the `components` property.

This property should be used for any external color slider that represents the
third component of the color. Note that this property uses the generic
`ColorComponent` type instead of the more accurate `HsvComponent`
to allow direct usage by the generalized color sliders.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/color_spectrum/color_spectrum_properties.rs#L239)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<ColorSpectrum>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
