2024-06-30 20:25:36 +02:00
|
|
|
// SPDX-FileCopyrightText: (C) 2024 Matyáš Caras
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-01-08 15:38:31 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|