ColorRoleToken class

Semantic color roles shared by every themed component.

The named constants resolve through the theme's Colors; ColorRoleToken.value derives a whole role scale from one arbitrary color for the current brightness.

Button(color: .danger, onPressed: delete, child: const Text('Delete'));
Button(color: .value(const Color(0xFF7C3AED)), onPressed: save, child: const Text('Save'))

Constructors

ColorRoleToken.value(Color color)
A role derived from color, ignoring the theme's role scales.
const

Properties

color → Color?
The seed color of a custom token; null for named tokens.
final
hashCode → int
The hash code for this object.
no setteroverride
isCustom → bool
Whether this token carries its own color rather than a theme role.
no setter
name → String
The token name; custom for ColorRoleToken.value.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Constants

accent → const ColorRoleToken
Brand emphasis.
danger → const ColorRoleToken
Destructive or error.
default_ → const ColorRoleToken
Neutral role.
success → const ColorRoleToken
Positive outcome.
values → const List<ColorRoleToken>
Every named token.
warning → const ColorRoleToken
Needs attention.