foregroundColor property
Color
get
foregroundColor
The foreground color of the button, based on role. Takes dark mode into consideration.
Implementation
Color get foregroundColor {
final brightness = SchedulerBinding.instance.platformDispatcher.platformBrightness;
final isDarkMode = brightness == Brightness.dark;
switch (this) {
case ViamButtonRole.primary:
return isDarkMode ? const Color.fromARGB(255, 240, 240, 240) : const Color.fromARGB(255, 40, 40, 41);
case ViamButtonRole.inverse:
return isDarkMode ? const Color.fromARGB(255, 40, 40, 41) : const Color.fromARGB(255, 240, 240, 240);
case ViamButtonRole.success:
return const Color.fromARGB(255, 255, 255, 255);
case ViamButtonRole.danger:
return const Color.fromARGB(255, 255, 255, 255);
case ViamButtonRole.warning:
return const Color.fromARGB(255, 255, 255, 255);
}
}