Skip to main content

ColorScheme

Struct ColorScheme 

Source
pub struct ColorScheme { /* private fields */ }
Expand description

{@template material_ui.color_scheme.ColorScheme} A set of 45 colors based on the Material spec that can be used to configure the color properties of most components. {@endtemplate}

§Colors in Material 3

{@macro material_ui.colors.colorRoles}

The main accent color groups in the scheme are primary, secondary, and tertiary.

  • Primary colors are used for key components across the UI, such as the FAB, prominent buttons, and active states.

  • Secondary colors are used for less prominent components in the UI, such as filter chips, while expanding the opportunity for color expression.

  • Tertiary colors are used for contrasting accents that can be used to balance primary and secondary colors or bring heightened attention to an element, such as an input field. The tertiary colors are left for makers to use at their discretion and are intended to support broader color expression in products.

Each accent color group (primary, secondary and tertiary) includes ‘-Fixed’ ‘-Dim’ color roles, such as primary_fixed and primary_fixed_dim. Fixed roles are appropriate to use in places where Container roles are normally used, but they stay the same color between light and dark themes. The ‘-Dim’ roles provide a stronger, more emphasized color with the same fixed behavior.

The remaining colors of the scheme are composed of neutral colors used for backgrounds and surfaces, as well as specific colors for errors, dividers and shadows. Surface colors are used for backgrounds and large, low-emphasis areas of the screen.

Material 3 also introduces tone-based surfaces and surface containers. They replace the old opacity-based model which applied a tinted overlay on top of surfaces based on their elevation. These colors include: surface_bright, surface_dim, surface_container_lowest, surface_container_low, surface_container, surface_container_high, and surface_container_highest.

Many of the colors have matching ‘on’ colors, which are used for drawing content on top of the matching color. For example, if something is using primary for a background color, on_primary would be used to paint text and icons on top of it. For this reason, the ‘on’ colors should have a contrast ratio with their matching colors of at least 4.5:1 in order to be readable. On ‘-FixedVariant’ roles, such as on_primary_fixed_variant, also have the same color between light and dark themes, but compared with on ‘-Fixed’ roles, such as on_primary_fixed, they provide a lower-emphasis option for text and icons.

This example shows all Material ColorScheme roles in light and dark brightnesses.

{@macro material_ui.dartpad_guide}

{@example /example/lib/color_scheme/color_scheme.0.dart#body}

§Setting Colors in Flutter

{@macro material_ui.colors.settingColors}

Implementations§

Source§

impl ColorScheme

Source

pub fn new( brightness: Brightness, primary: Color, on_primary: Color, secondary: Color, on_secondary: Color, error: Color, on_error: Color, surface: Color, on_surface: Color, ) -> ColorScheme

Create a ColorScheme instance from the given colors.

ColorScheme::from_seed can be used as a simpler way to create a full color scheme derived from a single seed color.

For the color parameters that are nullable, it is still recommended that applications provide values for them. They are only nullable due to backwards compatibility concerns.

If a color is not provided, the closest fallback color from the given colors will be used for it (e.g. primary_container will default to primary). Material Design 3 makes use of these colors for many component defaults, so for the best results the application should supply colors for all the parameters. An easy way to ensure this is to use ColorScheme::from_seed to generate a full set of colors.

During the migration to Material Design 3, if an app’s ThemeData.useMaterial3 is false, then components will only use the following colors for defaults:

  • primary
  • on_primary
  • secondary
  • on_secondary
  • error
  • on_error
  • surface
  • on_surface

DEPRECATED:

  • background
  • on_background
Source

pub fn with_brightness(self, brightness: Brightness) -> ColorScheme

Dart ColorScheme(brightness:).

Source

pub fn with_primary(self, primary: Color) -> ColorScheme

Dart ColorScheme(primary:).

Source

pub fn with_on_primary(self, on_primary: Color) -> ColorScheme

Dart ColorScheme(onPrimary:).

Source

pub fn with_primary_container(self, primary_container: Color) -> ColorScheme

Dart ColorScheme(primaryContainer:).

Source

pub fn with_on_primary_container( self, on_primary_container: Color, ) -> ColorScheme

Dart ColorScheme(onPrimaryContainer:).

Source

pub fn with_primary_fixed(self, primary_fixed: Color) -> ColorScheme

Dart ColorScheme(primaryFixed:).

Source

pub fn with_primary_fixed_dim(self, primary_fixed_dim: Color) -> ColorScheme

Dart ColorScheme(primaryFixedDim:).

Source

pub fn with_on_primary_fixed(self, on_primary_fixed: Color) -> ColorScheme

Dart ColorScheme(onPrimaryFixed:).

Source

pub fn with_on_primary_fixed_variant( self, on_primary_fixed_variant: Color, ) -> ColorScheme

Dart ColorScheme(onPrimaryFixedVariant:).

Source

pub fn with_secondary(self, secondary: Color) -> ColorScheme

Dart ColorScheme(secondary:).

Source

pub fn with_on_secondary(self, on_secondary: Color) -> ColorScheme

Dart ColorScheme(onSecondary:).

Source

pub fn with_secondary_container(self, secondary_container: Color) -> ColorScheme

Dart ColorScheme(secondaryContainer:).

Source

pub fn with_on_secondary_container( self, on_secondary_container: Color, ) -> ColorScheme

Dart ColorScheme(onSecondaryContainer:).

Source

pub fn with_secondary_fixed(self, secondary_fixed: Color) -> ColorScheme

Dart ColorScheme(secondaryFixed:).

Source

pub fn with_secondary_fixed_dim(self, secondary_fixed_dim: Color) -> ColorScheme

Dart ColorScheme(secondaryFixedDim:).

Source

pub fn with_on_secondary_fixed(self, on_secondary_fixed: Color) -> ColorScheme

Dart ColorScheme(onSecondaryFixed:).

Source

pub fn with_on_secondary_fixed_variant( self, on_secondary_fixed_variant: Color, ) -> ColorScheme

Dart ColorScheme(onSecondaryFixedVariant:).

Source

pub fn with_tertiary(self, tertiary: Color) -> ColorScheme

Dart ColorScheme(tertiary:).

Source

pub fn with_on_tertiary(self, on_tertiary: Color) -> ColorScheme

Dart ColorScheme(onTertiary:).

Source

pub fn with_tertiary_container(self, tertiary_container: Color) -> ColorScheme

Dart ColorScheme(tertiaryContainer:).

Source

pub fn with_on_tertiary_container( self, on_tertiary_container: Color, ) -> ColorScheme

Dart ColorScheme(onTertiaryContainer:).

Source

pub fn with_tertiary_fixed(self, tertiary_fixed: Color) -> ColorScheme

Dart ColorScheme(tertiaryFixed:).

Source

pub fn with_tertiary_fixed_dim(self, tertiary_fixed_dim: Color) -> ColorScheme

Dart ColorScheme(tertiaryFixedDim:).

Source

pub fn with_on_tertiary_fixed(self, on_tertiary_fixed: Color) -> ColorScheme

Dart ColorScheme(onTertiaryFixed:).

Source

pub fn with_on_tertiary_fixed_variant( self, on_tertiary_fixed_variant: Color, ) -> ColorScheme

Dart ColorScheme(onTertiaryFixedVariant:).

Source

pub fn with_error(self, error: Color) -> ColorScheme

Dart ColorScheme(error:).

Source

pub fn with_on_error(self, on_error: Color) -> ColorScheme

Dart ColorScheme(onError:).

Source

pub fn with_error_container(self, error_container: Color) -> ColorScheme

Dart ColorScheme(errorContainer:).

Source

pub fn with_on_error_container(self, on_error_container: Color) -> ColorScheme

Dart ColorScheme(onErrorContainer:).

Source

pub fn with_surface(self, surface: Color) -> ColorScheme

Dart ColorScheme(surface:).

Source

pub fn with_on_surface(self, on_surface: Color) -> ColorScheme

Dart ColorScheme(onSurface:).

Source

pub fn with_surface_dim(self, surface_dim: Color) -> ColorScheme

Dart ColorScheme(surfaceDim:).

Source

pub fn with_surface_bright(self, surface_bright: Color) -> ColorScheme

Dart ColorScheme(surfaceBright:).

Source

pub fn with_surface_container_lowest( self, surface_container_lowest: Color, ) -> ColorScheme

Dart ColorScheme(surfaceContainerLowest:).

Source

pub fn with_surface_container_low( self, surface_container_low: Color, ) -> ColorScheme

Dart ColorScheme(surfaceContainerLow:).

Source

pub fn with_surface_container(self, surface_container: Color) -> ColorScheme

Dart ColorScheme(surfaceContainer:).

Source

pub fn with_surface_container_high( self, surface_container_high: Color, ) -> ColorScheme

Dart ColorScheme(surfaceContainerHigh:).

Source

pub fn with_surface_container_highest( self, surface_container_highest: Color, ) -> ColorScheme

Dart ColorScheme(surfaceContainerHighest:).

Source

pub fn with_on_surface_variant(self, on_surface_variant: Color) -> ColorScheme

Dart ColorScheme(onSurfaceVariant:).

Source

pub fn with_outline(self, outline: Color) -> ColorScheme

Dart ColorScheme(outline:).

Source

pub fn with_outline_variant(self, outline_variant: Color) -> ColorScheme

Dart ColorScheme(outlineVariant:).

Source

pub fn with_shadow(self, shadow: Color) -> ColorScheme

Dart ColorScheme(shadow:).

Source

pub fn with_scrim(self, scrim: Color) -> ColorScheme

Dart ColorScheme(scrim:).

Source

pub fn with_inverse_surface(self, inverse_surface: Color) -> ColorScheme

Dart ColorScheme(inverseSurface:).

Source

pub fn with_on_inverse_surface(self, on_inverse_surface: Color) -> ColorScheme

Dart ColorScheme(onInverseSurface:).

Source

pub fn with_inverse_primary(self, inverse_primary: Color) -> ColorScheme

Dart ColorScheme(inversePrimary:).

Source

pub fn with_surface_tint(self, surface_tint: Color) -> ColorScheme

Dart ColorScheme(surfaceTint:).

Source

pub fn with_background(self, background: Color) -> ColorScheme

👎Deprecated:

Use surface instead. This feature was deprecated after v3.18.0-0.1.pre.

Dart ColorScheme(background:).

Source

pub fn with_on_background(self, on_background: Color) -> ColorScheme

👎Deprecated:

Use onSurface instead. This feature was deprecated after v3.18.0-0.1.pre.

Dart ColorScheme(onBackground:).

Source

pub fn with_surface_variant(self, surface_variant: Color) -> ColorScheme

👎Deprecated:

Use surfaceContainerHighest instead. This feature was deprecated after v3.18.0-0.1.pre.

Dart ColorScheme(surfaceVariant:).

Source

pub fn from_seed(seed_color: Color) -> ColorSchemeFromSeedBuilder

Generate a ColorScheme derived from the given seedColor.

Using the seedColor as a starting point, a set of tonal palettes are constructed. By default, the tonal palettes are based on the Material 3 Color system and provide all of the ColorScheme colors. These colors are designed to work well together and meet contrast requirements for accessibility.

If any of the optional color parameters are non-null they will be used in place of the generated colors for that field in the resulting color scheme. This allows apps to override specific colors for their needs.

Given the nature of the algorithm, the seedColor may not wind up as one of the ColorScheme colors.

The dynamicSchemeVariant parameter creates different types of DynamicSchemes, which are used to generate different styles of ColorSchemes. By default, dynamicSchemeVariant is set to tonalSpot. A ColorScheme constructed by dynamicSchemeVariant.tonalSpot has pastel palettes and won’t be too “colorful” even if the seedColor has a high chroma value. If the resulting color scheme is too dark, consider setting dynamicSchemeVariant to DynamicSchemeVariant.fidelity, whose palettes match the seed color.

The contrastLevel parameter indicates the contrast level between color pairs, such as primary and on_primary. 0.0 is the default (normal); -1.0 is the lowest; 1.0 is the highest. From Material Design guideline, the medium and high contrast correspond to 0.5 and 1.0 respectively.

This sample shows how to use ColorScheme::from_seed to create dynamic color schemes with different DynamicSchemeVariants and different contrast level.

{@macro material_ui.dartpad_guide}

{@example /example/lib/color_scheme/color_scheme.0.dart#body}

See also:

The builder takes brightness, dynamic_scheme_variant and contrast_level; Dart’s colour overrides are the with_* setters on the built scheme, since each replaces only its own colour.

Source

pub fn light() -> ColorScheme

Create a light ColorScheme based on a purple primary color that matches the baseline Material 2 color scheme.

This constructor shouldn’t be used to update the Material 3 color scheme.

For Material 3, use ColorScheme::from_seed to create a color scheme from a single seed color based on the Material 3 color system.

This example demonstrates how to create a color scheme similar to ColorScheme::light using the ColorScheme::from_seed constructor:

colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xff6200ee)).copyWith(
  primaryContainer: const Color(0xff6200ee),
  onPrimaryContainer: Colors.white,
  secondaryContainer: const Color(0xff03dac6),
  onSecondaryContainer: Colors.black,
  error: const Color(0xffb00020),
  onError: Colors.white,
),
Source

pub fn dark() -> ColorScheme

Create the dark color scheme that matches the baseline Material 2 color scheme.

This constructor shouldn’t be used to update the Material 3 color scheme.

For Material 3, use ColorScheme::from_seed to create a color scheme from a single seed color based on the Material 3 color system. Override the brightness property of ColorScheme::from_seed to create a dark color scheme.

This example demonstrates how to create a color scheme similar to ColorScheme::dark using the ColorScheme::from_seed constructor:

colorScheme: ColorScheme.fromSeed(
  seedColor: const Color(0xffbb86fc),
  brightness: Brightness.dark,
).copyWith(
  primaryContainer: const Color(0xffbb86fc),
  onPrimaryContainer: Colors.black,
  secondaryContainer: const Color(0xff03dac6),
  onSecondaryContainer: Colors.black,
  error: const Color(0xffcf6679),
  onError: Colors.black,
),
Source

pub fn high_contrast_light() -> ColorScheme

Create a high contrast ColorScheme based on a purple primary color that matches the baseline Material 2 color scheme.

This constructor shouldn’t be used to update the Material 3 color scheme.

For Material 3, use ColorScheme::from_seed to create a color scheme from a single seed color based on the Material 3 color system. To create a high-contrast color scheme, set contrastLevel to 1.0.

This example demonstrates how to create a color scheme similar to ColorScheme::high_contrast_light using the ColorScheme::from_seed constructor:

colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xff0000ba)).copyWith(
  primaryContainer: const Color(0xff0000ba),
  onPrimaryContainer: Colors.white,
  secondaryContainer: const Color(0xff66fff9),
  onSecondaryContainer: Colors.black,
  error: const Color(0xff790000),
  onError: Colors.white,
),
Source

pub fn high_contrast_dark() -> ColorScheme

Create a high contrast ColorScheme based on the dark baseline Material 2 color scheme.

This constructor shouldn’t be used to update the Material 3 color scheme.

For Material 3, use ColorScheme::from_seed to create a color scheme from a single seed color based on the Material 3 color system. Override the brightness property of ColorScheme::from_seed to create a dark color scheme. To create a high-contrast color scheme, set contrastLevel to 1.0.

This example demonstrates how to create a color scheme similar to ColorScheme::high_contrast_dark using the ColorScheme::from_seed constructor:

colorScheme: ColorScheme.fromSeed(
  seedColor: const Color(0xffefb7ff),
  brightness: Brightness.dark,
).copyWith(
  primaryContainer: const Color(0xffefb7ff),
  onPrimaryContainer: Colors.black,
  secondaryContainer: const Color(0xff66fff9),
  onSecondaryContainer: Colors.black,
  error: const Color(0xff9b374d),
  onError: Colors.white,
),
Source

pub fn from_swatch() -> ColorSchemeFromSwatchBuilder

Creates a color scheme from a MaterialColor swatch.

In Material 3, this constructor is ignored by ThemeData when creating its default color scheme. Instead, ThemeData uses ColorScheme::from_seed to create its default color scheme. This constructor shouldn’t be used to update the Material 3 color scheme. It will be phased out gradually; see https://github.com/flutter/flutter/issues/120064 for more details.

If ThemeData.useMaterial3 is false, then this constructor is used by ThemeData to create its default color scheme.

Source

pub fn brightness(&self) -> Brightness

The Brightness of this scheme.

Source

pub fn primary(&self) -> Color

The color displayed most frequently across your app’s screens and components.

Source

pub fn on_primary(&self) -> Color

A color that’s clearly legible when drawn on primary.

Source

pub fn primary_container(&self) -> Color

A color used for elements needing less emphasis than primary.

Source

pub fn on_primary_container(&self) -> Color

A color that’s clearly legible when drawn on primary_container.

To ensure that an app is accessible, a contrast ratio between primary_container and on_primary_container of at least 4.5:1 is recommended. See https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html.

Source

pub fn primary_fixed(&self) -> Color

A substitute for primary_container that’s the same color for the dark and light themes.

Source

pub fn primary_fixed_dim(&self) -> Color

A color used for elements needing more emphasis than primary_fixed.

Source

pub fn on_primary_fixed(&self) -> Color

A color that is used for text and icons that exist on top of elements having primary_fixed color.

Source

pub fn on_primary_fixed_variant(&self) -> Color

A color that provides a lower-emphasis option for text and icons than on_primary_fixed.

Source

pub fn secondary(&self) -> Color

An accent color used for less prominent components in the UI, such as filter chips, while expanding the opportunity for color expression.

Source

pub fn on_secondary(&self) -> Color

A color that’s clearly legible when drawn on secondary.

Source

pub fn secondary_container(&self) -> Color

A color used for elements needing less emphasis than secondary.

Source

pub fn on_secondary_container(&self) -> Color

A color that’s clearly legible when drawn on secondary_container.

To ensure that an app is accessible, a contrast ratio between secondary_container and on_secondary_container of at least 4.5:1 is recommended. See https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html.

Source

pub fn secondary_fixed(&self) -> Color

A substitute for secondary_container that’s the same color for the dark and light themes.

Source

pub fn secondary_fixed_dim(&self) -> Color

A color used for elements needing more emphasis than secondary_fixed.

Source

pub fn on_secondary_fixed(&self) -> Color

A color that is used for text and icons that exist on top of elements having secondary_fixed color.

Source

pub fn on_secondary_fixed_variant(&self) -> Color

A color that provides a lower-emphasis option for text and icons than on_secondary_fixed.

Source

pub fn tertiary(&self) -> Color

A color used as a contrasting accent that can balance primary and secondary colors or bring heightened attention to an element, such as an input field.

Source

pub fn on_tertiary(&self) -> Color

A color that’s clearly legible when drawn on tertiary.

To ensure that an app is accessible, a contrast ratio between tertiary and on_tertiary of at least 4.5:1 is recommended. See https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html.

Source

pub fn tertiary_container(&self) -> Color

A color used for elements needing less emphasis than tertiary.

Source

pub fn on_tertiary_container(&self) -> Color

A color that’s clearly legible when drawn on tertiary_container.

To ensure that an app is accessible, a contrast ratio between tertiary_container and on_tertiary_container of at least 4.5:1 is recommended. See https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html.

Source

pub fn tertiary_fixed(&self) -> Color

A substitute for tertiary_container that’s the same color for dark and light themes.

Source

pub fn tertiary_fixed_dim(&self) -> Color

A color used for elements needing more emphasis than tertiary_fixed.

Source

pub fn on_tertiary_fixed(&self) -> Color

A color that is used for text and icons that exist on top of elements having tertiary_fixed color.

Source

pub fn on_tertiary_fixed_variant(&self) -> Color

A color that provides a lower-emphasis option for text and icons than on_tertiary_fixed.

Source

pub fn error(&self) -> Color

The color to use for input validation errors, e.g. for an InputDecoration’s error text.

Source

pub fn on_error(&self) -> Color

A color that’s clearly legible when drawn on error.

Source

pub fn error_container(&self) -> Color

A color used for error elements needing less emphasis than error.

Source

pub fn on_error_container(&self) -> Color

A color that’s clearly legible when drawn on error_container.

To ensure that an app is accessible, a contrast ratio between error_container and on_error_container of at least 4.5:1 is recommended. See https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html.

Source

pub fn surface(&self) -> Color

The background color for widgets like Scaffold.

Source

pub fn on_surface(&self) -> Color

A color that’s clearly legible when drawn on surface.

Source

pub fn surface_variant(&self) -> Color

👎Deprecated:

Use surfaceContainerHighest instead. This feature was deprecated after v3.18.0-0.1.pre.

A color variant of surface that can be used for differentiation against a component using surface.

Source

pub fn surface_dim(&self) -> Color

A color that’s always darkest in the dark or light theme.

Source

pub fn surface_bright(&self) -> Color

A color that’s always the lightest in the dark or light theme.

Source

pub fn surface_container_lowest(&self) -> Color

A surface container color with the lightest tone and the least emphasis relative to the surface.

Source

pub fn surface_container_low(&self) -> Color

A surface container color with a lighter tone that creates less emphasis than surface_container but more emphasis than surface_container_lowest.

Source

pub fn surface_container(&self) -> Color

A recommended color role for a distinct area within the surface.

Surface container color roles are independent of elevation. They replace the old opacity-based model which applied a tinted overlay on top of surfaces based on their elevation.

Surface container colors include surface_container_lowest, surface_container_low, surface_container, surface_container_high and surface_container_highest.

Source

pub fn surface_container_high(&self) -> Color

A surface container color with a darker tone. It is used to create more emphasis than surface_container but less emphasis than surface_container_highest.

Source

pub fn surface_container_highest(&self) -> Color

A surface container color with the darkest tone. It is used to create the most emphasis against the surface.

Source

pub fn on_surface_variant(&self) -> Color

A color that’s clearly legible when drawn on surface_variant.

To ensure that an app is accessible, a contrast ratio between surface_variant and on_surface_variant of at least 4.5:1 is recommended. See https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html.

Source

pub fn outline(&self) -> Color

A utility color that creates boundaries and emphasis to improve usability.

Source

pub fn outline_variant(&self) -> Color

A utility color that creates boundaries for decorative elements when a 3:1 contrast isn’t required, such as for dividers or decorative elements.

Source

pub fn shadow(&self) -> Color

A color use to paint the drop shadows of elevated components.

Source

pub fn scrim(&self) -> Color

A color use to paint the scrim around of modal components.

Source

pub fn inverse_surface(&self) -> Color

A surface color used for displaying the reverse of what’s seen in the surrounding UI, for example in a SnackBar to bring attention to an alert.

Source

pub fn on_inverse_surface(&self) -> Color

A color that’s clearly legible when drawn on inverse_surface.

To ensure that an app is accessible, a contrast ratio between inverse_surface and on_inverse_surface of at least 4.5:1 is recommended. See https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html.

Source

pub fn inverse_primary(&self) -> Color

An accent color used for displaying a highlight color on inverse_surface backgrounds, like button text in a SnackBar.

Source

pub fn surface_tint(&self) -> Color

A color used as an overlay on a surface color to indicate a component’s elevation.

Source

pub fn background(&self) -> Color

👎Deprecated:

Use surface instead. This feature was deprecated after v3.18.0-0.1.pre.

A color that typically appears behind scrollable content.

Source

pub fn on_background(&self) -> Color

👎Deprecated:

Use onSurface instead. This feature was deprecated after v3.18.0-0.1.pre.

A color that’s clearly legible when drawn on background.

To ensure that an app is accessible, a contrast ratio between background and on_background of at least 4.5:1 is recommended. See https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html.

Source

pub fn copy_with(&self) -> ColorScheme

Creates a copy of this color scheme with the given fields replaced by the non-null parameter values.

Every colour that falls back to another is filled with what it reads now, as Dart’s copyWith passes this.primaryContainer on; the with_* setters then replace them.

Source

pub fn lerp(a: &ColorScheme, b: &ColorScheme, t: f64) -> ColorScheme

Linearly interpolate between two ColorScheme objects.

{@macro dart.ui.shadow.lerp}

Source

pub fn of(app: &mut App, context: BuildContext) -> ColorScheme

The ThemeData::color_scheme of the ambient Theme.

Equivalent to Theme::of(app, context).color_scheme.

Trait Implementations§

Source§

impl Clone for ColorScheme

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ColorScheme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Diagnosticable for ColorScheme

Source§

fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)

Add additional properties associated with the node.
Source§

fn type_name(&self) -> &'static str

Dart’s Object.runtimeType as diagnostics print it: the last segment of the Rust type path, without generic arguments.
Source§

fn identity_hash(&self) -> u64

Dart’s Object.hashCode as diagnostics print it: the object’s address.
Source§

fn to_string_short(&self) -> String

A brief description of this object, usually just the type and the hash.
Source§

fn to_diagnostics_node(&self) -> DiagnosticableNode

Returns a debug representation of the object used by debugging tools and by DiagnosticsNode::to_string_deep.
Source§

fn to_diagnostics_node_with( &self, name: Option<String>, style: Option<DiagnosticsTreeStyle>, ) -> DiagnosticableNode

Dart toDiagnosticsNode(name:, style:).
Source§

fn to_string(&self) -> String

Dart’s toString: a single-line description with properties and no children. Read more
Source§

fn to_string_at(&self, min_level: DiagnosticLevel) -> String

Dart’s toString(minLevel:).
Source§

impl Display for ColorScheme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ColorScheme

Source§

fn eq(&self, other: &ColorScheme) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,