getColorToken static method

Color getColorToken(
  1. BuildContext context,
  2. OudsButtonHierarchy hierarchy
)

Implementation

static Color getColorToken(BuildContext context, OudsButtonHierarchy hierarchy) {
  final theme = OudsTheme.of(context);
  final onColoredSurface = OudsTheme.isOnColoredSurfaceOf(context);
  switch (hierarchy) {
    case OudsButtonHierarchy.strong:
      return onColoredSurface ? theme.componentsTokens(context).buttonMono.colorContentStrongLoading : theme.colorScheme(context).contentOnActionLoading;
    case OudsButtonHierarchy.brand:
      return theme.colorScheme(context).contentOnActionLoading;
    case OudsButtonHierarchy.minimal:
      return onColoredSurface ? theme.componentsTokens(context).buttonMono.colorContentMinimalLoading : theme.componentsTokens(context).button.colorContentMinimalLoading;
    case OudsButtonHierarchy.negative:
      return theme.colorScheme(context).contentOnStatusNegativeEmphasized;
    default:
      return onColoredSurface ? theme.componentsTokens(context).buttonMono.colorContentDefaultLoading : theme.componentsTokens(context).button.colorContentDefaultLoading;
  }
}