# ColorPaletteResourcesCollection

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-themes-fluent/struct-colorpaletteresourcescollection/

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

```rust
struct ColorPaletteResourcesCollection
```

The colour palettes of a `FluentTheme` by theme
variant: a dictionary that is also the resource provider of the palette
of the requested variant.

The managed class implements `IDictionary<ThemeVariant,
ColorPaletteResources>` over an inner observable dictionary; here the
dictionary members are inherent methods.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L21)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`as_resource_provider`](#function-as_resource_provider)
- [`count`](#function-count)
- [`add`](#function-add)
- [`try_add`](#function-try_add)
- [`clear`](#function-clear)
- [`contains_key`](#function-contains_key)
- [`remove`](#function-remove)
- [`try_get_value`](#function-try_get_value)
- [`get`](#function-get)
- [`set`](#function-set)
- [`keys`](#function-keys)
- [`values`](#function-values)
- [`to_vec`](#function-to_vec)

<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.Themes.Fluent/color_palette_resources_collection.rs#L26)

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

### to_ref

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

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L26)

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

### construct

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

Field initialisation; see `ResourceProvider::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L95)

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

### new

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L99)

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

### as_resource_provider

```rust
fn as_resource_provider(self: &Self) -> Rc<dyn IResourceProvider>
```

The provider as the resource provider interface.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L124)

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

### count

```rust
fn count(self: &Self) -> usize
```

The number of palettes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L129)

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

### add

```rust
fn add(self: &Self, key: ThemeVariant, value: Ref<ColorPaletteResources>)
```

Adds the palette of a variant.
## Panics
Panics if the variant already has a palette, or if it is neither the
light nor the dark variant.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L138)

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

### try_add

```rust
fn try_add(self: &Self, key: ThemeVariant, value: Ref<ColorPaletteResources>) -> Result<(), String>
```

`add` for untyped callers (markup): the failures are
errors. A variant that is not supported is rejected before the
palette is added.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L145)

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

### clear

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

Removes all palettes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L157)

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

### contains_key

```rust
fn contains_key(self: &Self, key: &ThemeVariant) -> bool
```

Whether the variant has a palette.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L162)

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

### remove

```rust
fn remove(self: &Self, key: &ThemeVariant) -> bool
```

Removes the palette of a variant; returns whether there was one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L167)

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

### try_get_value

```rust
fn try_get_value(self: &Self, key: &ThemeVariant) -> Option<Ref<ColorPaletteResources>>
```

The palette of a variant.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L172)

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

### get

```rust
fn get(self: &Self, key: &ThemeVariant) -> Ref<ColorPaletteResources>
```

The palette of a variant.
## Panics
Panics if the variant has no palette.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L180)

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

### set

```rust
fn set(self: &Self, key: ThemeVariant, value: Ref<ColorPaletteResources>)
```

Sets the palette of a variant, replacing the one it has.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L185)

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

### keys

```rust
fn keys(self: &Self) -> Vec<ThemeVariant>
```

The variants with a palette.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L190)

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

### values

```rust
fn values(self: &Self) -> Vec<Ref<ColorPaletteResources>>
```

The palettes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L195)

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

### to_vec

```rust
fn to_vec(self: &Self) -> Vec<(ThemeVariant, Ref<ColorPaletteResources>)>
```

The palettes with their variants.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Fluent/color_palette_resources_collection.rs#L200)

## 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`
- [`ResourceProviderImplExt`](/docs/0.5.0/api/ferroui-base/controls/trait-resourceproviderimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<ColorPaletteResourcesCollection>`](/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/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`ResourceProviderImpl`](/docs/0.5.0/api/ferroui-base/controls/trait-resourceproviderimpl/)

## Availability

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