Add util for getting text color based on background

This commit is contained in:
krawieck 2020-09-02 23:09:33 +02:00
parent 4bc6164b64
commit b13508c011
1 changed files with 9 additions and 0 deletions

9
lib/util/text_color.dart Normal file
View File

@ -0,0 +1,9 @@
import 'package:flutter/material.dart';
Color textColorBasedOnBackground(Color color) {
if (color.computeLuminance() > 0.5) {
return Colors.black;
} else {
return Colors.white;
}
}