mirror of
https://github.com/krawieck/lemmur/
synced 2024-12-15 10:04:13 +01:00
12 lines
280 B
Dart
12 lines
280 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// Given the background color, returns a text color
|
|
/// with a good contrast ratio
|
|
Color textColorBasedOnBackground(Color color) {
|
|
if (color.computeLuminance() > 0.5) {
|
|
return Colors.black;
|
|
} else {
|
|
return Colors.white;
|
|
}
|
|
}
|