# KnownColors

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/struct-knowncolors/

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

```rust
struct KnownColors
```

Lookups between color names and known colors.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/known_colors.rs#L170)

## Members

- [`get_known_color`](#function-get_known_color)
- [`get_known_color_name`](#function-get_known_color_name)
- [`try_get_known_color_name`](#function-try_get_known_color_name)
- [`values`](#function-values)
- [`to_color`](#function-to_color)
- [`get_known_brush`](#function-get_known_brush)

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

### get_known_color

```rust
fn get_known_color(s: &str) -> KnownColor
```

Gets the known color with the given name (ASCII case-insensitive), or
`KnownColor::NONE` when there is no such color.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/known_colors.rs#L175)

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

### get_known_color_name

```rust
fn get_known_color_name(rgb: u32) -> Option<&'static str>
```

Gets the name of the known color with the given ARGB value. When several
names share the value, the first one in declaration order is returned.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/known_colors.rs#L184)

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

### try_get_known_color_name

```rust
fn try_get_known_color_name(rgb: u32) -> Option<&'static str>
```

Same as `get_known_color_name`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/known_colors.rs#L193)

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

### values

```rust
fn values() -> impl Iterator<Item = KnownColor>
```

The known colors in ascending order of their ARGB values, one per
value: the counterpart of `Enum.GetValues<KnownColor>()` without
`None` (which the original lists first) and without the second name of
a shared value, which has the same value and the same name
(`get_known_color_name`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/known_colors.rs#L202)

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

### to_color

```rust
const fn to_color(color: KnownColor) -> Color
```

Converts the known color to a `Color`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/known_colors.rs#L208)

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

### get_known_brush

```rust
fn get_known_brush(s: &str) -> Option<Rc<ImmutableSolidColorBrush>>
```

Gets the cached brush of the known color with the given name (ASCII
case-insensitive), or `None` when there is no such color.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/known_color_brushes.rs#L32)

## Trait implementations

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

## Availability

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