resolveTokenValueObjectForMode function

String resolveTokenValueObjectForMode(
  1. AstryxTokenValue value,
  2. AstryxThemeMode mode
)

Resolves an AstryxTokenValue for mode.

A pair yields its matching half directly, without a round trip through light-dark() string parsing.

Implementation

String resolveTokenValueObjectForMode(
  AstryxTokenValue value,
  AstryxThemeMode mode,
) {
  final dark = value.dark;
  if (dark != null) return mode == AstryxThemeMode.dark ? dark : value.light;
  return resolveTokenValueForMode(value.light, mode);
}