stylePalette static method

AuthyoTheme stylePalette(
  1. AuthyoDesignStyle style, {
  2. Color? primary,
})

Default palette for a design style — the same values the Authyo dashboard loads into the Color tab when that style is picked, so a locally pinned style looks like the dashboard preview. Layered under the dashboard / local values: defaults.merge(stylePalette).merge(remote).

Implementation

static AuthyoTheme stylePalette(AuthyoDesignStyle style, {Color? primary}) {
  final btn = primary ?? AppColor.primary;
  Color mix(Color a, Color b, double tOfB) => Color.lerp(a, b, tOfB)!;
  switch (style) {
    case AuthyoDesignStyle.flat:
    case AuthyoDesignStyle.flat2:
      return const AuthyoTheme();
    case AuthyoDesignStyle.minimalism:
      return const AuthyoTheme(
        background: Colors.white,
        surface: Colors.white,
        headerTextColor: Color(0xFF1F2333),
        bodyTextColor: Color(0xFF5B6070),
        inputBackground: Colors.white,
        inputBorder: Color(0xFF9A9DB0),
        inputText: Color(0xFF1F2333),
        buttonColor: Color(0xFF1F2333),
        buttonTextColor: Colors.white,
        buttonBorderColor: Color(0xFF1F2333),
        socialButtonColor: Colors.white,
        socialButtonBorderColor: Color(0xFF9A9DB0),
      );
    case AuthyoDesignStyle.skeuomorphism:
      return const AuthyoTheme(
        background: Color(0xFFF2F3F7),
        surface: Color(0xFFF2F3F7),
        inputBackground: Color(0xFFECEEF5),
        inputBorder: Color(0xFFB9BCC9),
        socialButtonColor: Color(0xFFF4F5F9),
        socialButtonBorderColor: Color(0xFFB9BCC9),
      );
    case AuthyoDesignStyle.claymorphism:
      final pastel = mix(btn, Colors.white, 0.88);
      return AuthyoTheme(
        background: pastel,
        surface: pastel,
        headerTextColor: const Color(0xFF1F2333),
        bodyTextColor: const Color(0xFF5B6070),
        inputBackground: Colors.white,
        inputBorder: pastel,
        inputText: const Color(0xFF1F2333),
        buttonBorderColor: btn,
        socialButtonColor: Colors.white,
        socialButtonBorderColor: mix(btn, Colors.white, 0.75),
      );
    case AuthyoDesignStyle.glassmorphism:
      // Frost of the user's own colours; only surfaces are nudged.
      return const AuthyoTheme(
        background: Colors.white,
        surface: Colors.white,
        inputBackground: Colors.white,
        inputBorder: Colors.white,
        socialButtonColor: Colors.white,
        socialButtonBorderColor: Colors.white,
      );
    case AuthyoDesignStyle.neumorphism:
      return const AuthyoTheme(
        background: Color(0xFFE0E5EC),
        surface: Color(0xFFE0E5EC),
        headerTextColor: Color(0xFF3A4152),
        bodyTextColor: Color(0xFF3A4152),
        inputBackground: Color(0xFFE0E5EC),
        inputBorder: Color(0xFFE0E5EC),
        inputText: Color(0xFF3A4152),
        buttonBorderColor: Color(0xFFE0E5EC),
        socialButtonColor: Color(0xFFE0E5EC),
        socialButtonTextColor: Color(0xFF3A4152),
        socialButtonBorderColor: Color(0xFFE0E5EC),
      );
  }
}