# MaterialColorScheme

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-themes-material/struct-materialcolorscheme/

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

```rust
struct MaterialColorScheme
```



[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L227)

## Members

- [`new`](#function-new)
- [`color`](#function-color)
- [`set_color`](#function-set_color)
- [`with_color`](#function-with_color)
- [`light`](#function-light)
- [`dark`](#function-dark)
- [`expressive_light`](#function-expressive_light)
- [`status_color`](#function-status_color)
- [`resources`](#function-resources)
- [`from_seed`](#function-from_seed)
- [`from_seed_color`](#function-from_seed_color)
- [`from_seed_with_options`](#function-from_seed_with_options)
- [`from_seed_with_spec`](#function-from_seed_with_spec)
- [`from_android_system_roles`](#function-from_android_system_roles)

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

### new

```rust
const fn new(colors: [Color; 48]) -> Self
```

All roles are required, in MaterialColorRole::ALL order.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L233)

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

### color

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L234)

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

### set_color

```rust
fn set_color(self: &mut Self, role: MaterialColorRole, color: Color)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L235)

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

### with_color

```rust
fn with_color(self: Self, role: MaterialColorRole, color: Color) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L236)

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

### light

```rust
const fn light() -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L237)

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

### dark

```rust
const fn dark() -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L287)

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

### expressive_light

```rust
const fn expressive_light() -> Self
```

Native MaterialExpressiveTheme light baseline, including its four tone-30 container foregrounds.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L338)

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

### status_color

```rust
fn status_color(self: &Self, status: MaterialStatusColor) -> Color
```

A status color: of the light palette for a light surface, of the dark one for a dark surface.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L347)

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

### resources

```rust
fn resources(self: &Self) -> Ref<ResourceDictionary>
```

A fresh dictionary permits atomic replacement: no frame observes half a palette.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/color_scheme.rs#L353)

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

### from_seed

```rust
fn from_seed(seed: Color, dark: bool) -> Self
```

Standard-contrast Tonal Spot scheme, generated with CAM16/HCT. Seed alpha
is ignored, matching the opaque source-color contract of Material utilities.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/dynamic_color.rs#L346)

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

### from_seed_color

```rust
fn from_seed_color(seed: Color, dark: bool, contrast_level: f64) -> Result<Self, MaterialDynamicColorError>
```

Generates all 48 roles, including fixed and surface-container roles, with
the Tonal Spot palette and an explicit contrast level in [-1, 1].

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/dynamic_color.rs#L359)

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

### from_seed_with_options

```rust
fn from_seed_with_options(seed: Color, options: MaterialDynamicColorOptions) -> Result<Self, MaterialDynamicColorError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/dynamic_color.rs#L374)

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

### from_seed_with_spec

```rust
fn from_seed_with_spec(seed: Color, options: MaterialDynamicColorOptions, source_spec: MaterialColorSpec) -> Result<Self, MaterialDynamicColorError>
```

Generates all 48 roles using an explicit source specification and its
official phone-variant fallback. `Spec2025` enables the current expressive
palettes, chroma-sensitive surfaces, and independent tone constraints.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/dynamic_color.rs#L384)

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

### from_android_system_roles

```rust
fn from_android_system_roles(dark: bool, resolve: impl FnMut(MaterialColorRole) -> Option<Color>) -> Result<Self, MaterialDynamicColorError>
```

Losslessly imports Android 14/API 34+ roles, including system high-contrast
adjustments. The host resolves the corresponding `mc3_light_scheme` or
`mc3_dark_scheme` attributes. As in AndroidX, error roles and scrim retain
their baseline defaults when absent; supplied overrides are preserved.
Every other role is required. This method does not query Android or JNI.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Themes.Material/dynamic_color.rs#L413)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Equivalent<K>`
- `CastableFrom<ST, Uninit, Uninit>`
- `CastableFrom<ST, Initialized, Initialized>`
- `Read<Exclusive, BecauseExclusive>`
- `Clone`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `Default`

## Availability

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