2020-09-02 23:09:33 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2020-09-30 19:05:00 +02:00
|
|
|
/// Given the background color, returns a text color
|
|
|
|
/// with a good contrast ratio
|
2020-09-02 23:09:33 +02:00
|
|
|
Color textColorBasedOnBackground(Color color) {
|
|
|
|
if (color.computeLuminance() > 0.5) {
|
|
|
|
return Colors.black;
|
|
|
|
} else {
|
|
|
|
return Colors.white;
|
|
|
|
}
|
|
|
|
}
|