# ColorHelper

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

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

```rust
struct ColorHelper
```

Contains helpers useful when working with colors.

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

## Members

- [`get_relative_luminance`](#function-get_relative_luminance)
- [`to_display_name_exists`](#function-to_display_name_exists)
- [`to_display_name`](#function-to_display_name)

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

### get_relative_luminance

```rust
fn get_relative_luminance(color: Color) -> f64
```

Gets the relative (perceptual) luminance/brightness of the given color.
1 is closer to white while 0 is closer to black.

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

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

### to_display_name_exists

```rust
fn to_display_name_exists() -> bool
```

Determines if color display names are supported based on the current thread culture.

Only English names are currently supported following known color names.
In the future known color names could be localized.

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

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

### to_display_name

```rust
fn to_display_name(color: Color) -> String
```

Determines an approximate display name for the given color.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

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