backgroundColor property

Color get backgroundColor

The background color of the button, based on role. Takes dark mode into consideration.

Implementation

Color get backgroundColor {
  final brightness = SchedulerBinding.instance.platformDispatcher.platformBrightness;
  final isDarkMode = brightness == Brightness.dark;
  switch (this) {
    case ViamButtonRole.primary:
      return isDarkMode ? const Color.fromARGB(255, 40, 40, 41) : const Color.fromARGB(255, 240, 240, 240);
    case ViamButtonRole.inverse:
      return isDarkMode ? const Color.fromARGB(255, 240, 240, 240) : const Color.fromARGB(255, 40, 40, 41);
    case ViamButtonRole.success:
      return isDarkMode ? const Color.fromARGB(255, 105, 153, 103) : const Color.fromARGB(255, 61, 125, 63);
    case ViamButtonRole.danger:
      return isDarkMode ? const Color.fromARGB(255, 211, 103, 94) : const Color.fromARGB(255, 190, 53, 54);
    case ViamButtonRole.warning:
      return isDarkMode ? const Color.fromARGB(255, 250, 185, 82) : const Color.fromARGB(255, 242, 166, 0);
  }
}