PrismColors class
Semantic colors derived from the active ColorScheme.
Prism components need more meaning than a raw ColorScheme provides — "what color is a success state?", "what surface does a toast sit on?". PrismColors answers those once, consistently, and adapts automatically to light/dark mode and Material You dynamic color.
final colors = PrismColors.of(context);
Container(color: colors.forRole(PrismSemantic.success).background);
- Annotations
Constructors
- PrismColors({required Color success, required Color onSuccess, required Color successContainer, required Color onSuccessContainer, required Color warning, required Color onWarning, required Color warningContainer, required Color onWarningContainer, required Color error, required Color onError, required Color errorContainer, required Color onErrorContainer, required Color info, required Color onInfo, required Color infoContainer, required Color onInfoContainer, required Color surfaceRaised, required Color surfaceSunken, required Color outline, required Color overlay})
-
Creates a semantic color set. Prefer of so values track the theme.
const
Properties
- error → Color
-
Failure accent.
final
- errorContainer → Color
-
Error container background.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- info → Color
-
Neutral information accent.
final
- infoContainer → Color
-
Info container background.
final
- onError → Color
-
Content color on error.
final
- onErrorContainer → Color
-
Content color on errorContainer.
final
- onInfo → Color
-
Content color on info.
final
- onInfoContainer → Color
-
Content color on infoContainer.
final
- onSuccess → Color
-
Content color on success.
final
- onSuccessContainer → Color
-
Content color on successContainer.
final
- onWarning → Color
-
Content color on warning.
final
- onWarningContainer → Color
-
Content color on warningContainer.
final
- outline → Color
-
Hairline border color.
final
- overlay → Color
-
Scrim/tint color for overlays over imagery.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- success → Color
-
Positive/success accent.
final
- successContainer → Color
-
Success container background.
final
- surfaceRaised → Color
-
A surface one step above the base surface — cards, banners, sheets.
final
- surfaceSunken → Color
-
A surface one step below the base surface — wells, code blocks.
final
- warning → Color
-
Caution/warning accent.
final
- warningContainer → Color
-
Warning container background.
final
Methods
-
accentForRole(
PrismSemantic role) → Color -
Solid accent color for a semantic
role— use when a filled chip, dot or badge needs to stand out against the base surface. -
forRole(
PrismSemantic role) → ({Color background, Color foreground}) -
Background/foreground pair for a semantic
role. -
iconForRole(
PrismSemantic role) → IconData -
The icon conventionally paired with a semantic
role. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
of(
BuildContext context) → PrismColors - Derives semantic colors from the ambient ThemeData.
-
resolve(
ColorScheme scheme, Brightness brightness) → PrismColors - Derives semantic colors from an explicit scheme and brightness — useful when you have a theme but no BuildContext.