# ColorSlider

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

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

```rust
struct ColorSlider
```

A slider with a background that represents a single color component.

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

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`on_color_changed`](#function-on_color_changed)
- [`PC_DARK_SELECTOR`](#assoc_const-pc_dark_selector)
- [`PC_LIGHT_SELECTOR`](#assoc_const-pc_light_selector)
- [`PSEUDO_CLASSES`](#assoc_const-pseudo_classes)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`color_changed`](#function-color_changed)
- [`ignore_property_changed`](#function-ignore_property_changed)
- [`set_ignore_property_changed`](#function-set_ignore_property_changed)
- [`color_property`](#function-color_property)
- [`color_component_property`](#function-color_component_property)
- [`color_model_property`](#function-color_model_property)
- [`hsv_color_property`](#function-hsv_color_property)
- [`is_alpha_visible_property`](#function-is_alpha_visible_property)
- [`is_perceptive_property`](#function-is_perceptive_property)
- [`is_rounding_enabled_property`](#function-is_rounding_enabled_property)
- [`color`](#function-color)
- [`set_color`](#function-set_color)
- [`color_component`](#function-color_component)
- [`set_color_component`](#function-set_color_component)
- [`color_model`](#function-color_model)
- [`set_color_model`](#function-set_color_model)
- [`hsv_color`](#function-hsv_color)
- [`set_hsv_color`](#function-set_hsv_color)
- [`is_alpha_visible`](#function-is_alpha_visible)
- [`set_is_alpha_visible`](#function-set_is_alpha_visible)
- [`is_perceptive`](#function-is_perceptive)
- [`set_is_perceptive`](#function-set_is_perceptive)
- [`is_rounding_enabled`](#function-is_rounding_enabled)
- [`set_is_rounding_enabled`](#function-set_is_rounding_enabled)

<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_slider/color_slider.rs#L43)

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

### to_ref

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

Returns a strong reference to this object.

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

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

### on_color_changed

```rust
fn on_color_changed(self: &Self, e: &ColorChangedEventArgs)
```

Raises the color changed event.

`e` defines the old/new colors.

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

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

### PC_DARK_SELECTOR

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

The pseudo-class of a dark selector thumb.

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

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

### PC_LIGHT_SELECTOR

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

The pseudo-class of a light selector thumb.

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

<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_slider/color_slider.rs#L167)

<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_slider/color_slider.rs#L171)

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

### new

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

Initializes a new instance of the `ColorSlider` class.

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

<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 slider.
Disposing the returned handle unsubscribes.

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

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

### ignore_property_changed

```rust
fn ignore_property_changed(self: &Self) -> bool
```

Whether property changes are ignored while the slider updates its own
properties (a protected field of the original).

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

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

### set_ignore_property_changed

```rust
fn set_ignore_property_changed(self: &Self, value: bool)
```

Sets `ignore_property_changed`.

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

<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_slider/color_slider_properties.rs#L7)

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

### color_component_property

```rust
fn color_component_property() -> &'static StyledProperty<ColorComponent>
```

Defines the `ColorComponent` property.

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

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

### color_model_property

```rust
fn color_model_property() -> &'static StyledProperty<ColorModel>
```

Defines the `ColorModel` property.

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

<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_slider/color_slider_properties.rs#L7)

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

### is_alpha_visible_property

```rust
fn is_alpha_visible_property() -> &'static StyledProperty<bool>
```

Defines the `IsAlphaVisible` property.

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

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

### is_perceptive_property

```rust
fn is_perceptive_property() -> &'static StyledProperty<bool>
```

Defines the `IsPerceptive` property.

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

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

### is_rounding_enabled_property

```rust
fn is_rounding_enabled_property() -> &'static StyledProperty<bool>
```

Defines the `IsRoundingEnabled` property.

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

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

### color

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

Gets the currently selected color in the RGB color model.

Use this property instead of `hsv_color` when in
`ColorModel::Rgba` to avoid loss of precision and color drifting.

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

<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_slider/color_slider_properties.rs#L74)

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

### color_component

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

Gets the color component represented by the slider.

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

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

### set_color_component

```rust
fn set_color_component(self: &Self, value: ColorComponent)
```

Sets `color_component`.

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

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

### color_model

```rust
fn color_model(self: &Self) -> ColorModel
```

Gets the active color model used by the slider.

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

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

### set_color_model

```rust
fn set_color_model(self: &Self, value: ColorModel)
```

Sets `color_model`.

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

<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.

Use this property instead of `color` when in
`ColorModel::Hsva` to avoid loss of precision and color drifting.

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

<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_slider/color_slider_properties.rs#L107)

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

### is_alpha_visible

```rust
fn is_alpha_visible(self: &Self) -> bool
```

Gets a value indicating whether the alpha component is visible and rendered.
When false, this ensures that the gradient is always visible and never transparent regardless of
the actual color. This property is ignored when the alpha component itself is being displayed.

Setting to false means the alpha component is always forced to maximum for components other than
`color_component` during rendering. This doesn't change the value of the
alpha component in the color – it is only for display.

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

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

### set_is_alpha_visible

```rust
fn set_is_alpha_visible(self: &Self, value: bool)
```

Sets `is_alpha_visible`.

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

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

### is_perceptive

```rust
fn is_perceptive(self: &Self) -> bool
```

Gets a value indicating whether the slider adapts rendering to improve user-perception
over exactness.

When true in the HSVA color model, this ensures that the gradient is always visible and
never washed out regardless of the actual color. When true in the RGBA color model, this ensures
the gradient always appears as red, green or blue.

For example, with Hue in the HSVA color model, the Saturation and Value components are always forced
to maximum values during rendering. In the RGBA color model, all components other than
`color_component` are forced to minimum values during rendering.

Note this property will only adjust components other than `color_component`
during rendering. This also doesn't change the values of any components in the actual color – it is
only for display.

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

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

### set_is_perceptive

```rust
fn set_is_perceptive(self: &Self, value: bool)
```

Sets `is_perceptive`.

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

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

### is_rounding_enabled

```rust
fn is_rounding_enabled(self: &Self) -> bool
```

Gets a value indicating whether rounding of color component values is enabled.

This is applicable for the HSV color model only. The `HsvColor` struct uses double
values while the `Color` struct uses byte. Only double types need rounding.

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

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

### set_is_rounding_enabled

```rust
fn set_is_rounding_enabled(self: &Self, value: bool)
```

Sets `is_rounding_enabled`.

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

## 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/)
- [`SliderImplExt`](/docs/0.5.0/api/ferroui-controls/trait-sliderimplext/)
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<ColorSlider>`](/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/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)
- [`SliderImpl`](/docs/0.5.0/api/ferroui-controls/trait-sliderimpl/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`ColorSliderImpl`](/docs/0.5.0/api/ferroui-controls-color-picker/primitives/trait-colorsliderimpl/)

## Availability

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