expressiveResolveColors function
ExpressiveColorScheme
expressiveResolveColors(
- ExpressiveBakedTheme baked,
- Brightness brightness, {
- double? contrast,
baked's colour roles in brightness, at the theme's own contrast or,
given contrast, at that baked level. Throws when the level was not
baked, or when the baked part does not carry exactly the
ExpressiveColorRoles.
Implementation
ExpressiveColorScheme expressiveResolveColors(
ExpressiveBakedTheme baked,
Brightness brightness, {
double? contrast,
}) {
var colors = baked.colors;
if (contrast != null && contrast != baked.contrast) {
final at = colors.atContrast[_contrastKey(contrast)];
if (at == null) {
throw StateError(
'The baked theme "${baked.id}" has no colours at contrast $contrast '
'(baked: ${[_contrastKey(baked.contrast), ...colors.atContrast.keys].join(', ')}).',
);
}
colors = at;
}
return expressiveColorsFromArgb(
brightness == Brightness.dark ? colors.dark : colors.light,
'The baked theme "${baked.id}"',
);
}