6163a95849
Reviewed-on: #19
11 lines
356 B
Dart
11 lines
356 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// Used to add [calculateTextColor] to the [Color] class
|
|
extension TextColor on Color {
|
|
/// Returns if foreground should be white or dark on this [Color]
|
|
Color calculateTextColor() {
|
|
return ThemeData.estimateBrightnessForColor(this) == Brightness.light
|
|
? Colors.black
|
|
: Colors.white;
|
|
}
|
|
}
|