This repository has been archived on 2024-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
dialer/lib/widgets/color_darkener.dart
2024-10-18 22:45:35 +03:00

10 lines
280 B
Dart

import 'package:flutter/material.dart';
Color darken(Color color, [double amount = .1]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(color);
final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
return hslDark.toColor();
}