mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-05 03:29:30 +01:00
fix: Contrast in dark mode
This commit is contained in:
parent
76d8dbbe09
commit
ff8bba03ae
@ -129,10 +129,10 @@ abstract class FluffyThemes {
|
||||
backgroundColor: Colors.black,
|
||||
scaffoldBackgroundColor: Colors.black,
|
||||
colorScheme: ThemeData.dark().colorScheme.copyWith(
|
||||
primary: AppConfig.chatColor,
|
||||
secondary: AppConfig.chatColor,
|
||||
primary: FluffyThemes.lighten(AppConfig.chatColor, 0.33),
|
||||
secondary: FluffyThemes.lighten(AppConfig.chatColor, 0.33),
|
||||
secondaryVariant: AppConfig.secondaryColor,
|
||||
surface: FluffyThemes.darken(AppConfig.chatColor, 0.4),
|
||||
surface: FluffyThemes.darken(AppConfig.chatColor, 0.25, 0.2),
|
||||
),
|
||||
secondaryHeaderColor: Colors.blueGrey.shade900,
|
||||
textTheme: Typography.material2018().white.merge(fallbackTextTheme),
|
||||
@ -212,21 +212,28 @@ abstract class FluffyThemes {
|
||||
? Colors.white
|
||||
: Colors.black;
|
||||
|
||||
static Color darken(Color color, [double amount = .1]) {
|
||||
static Color darken(Color color, [double amount = .1, double saturation]) {
|
||||
assert(amount >= 0 && amount <= 1);
|
||||
|
||||
final hsl = HSLColor.fromColor(color);
|
||||
final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
|
||||
var hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
|
||||
if (saturation != null) {
|
||||
hslDark =
|
||||
hslDark.withSaturation((hsl.saturation - saturation).clamp(0.0, 1.0));
|
||||
}
|
||||
|
||||
return hslDark.toColor();
|
||||
}
|
||||
|
||||
static Color lighten(Color color, [double amount = .1]) {
|
||||
static Color lighten(Color color, [double amount = .1, double saturation]) {
|
||||
assert(amount >= 0 && amount <= 1);
|
||||
|
||||
final hsl = HSLColor.fromColor(color);
|
||||
final hslLight =
|
||||
hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0));
|
||||
var hslLight = hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0));
|
||||
if (saturation != null) {
|
||||
hslLight = hslLight
|
||||
.withSaturation((hsl.saturation - saturation).clamp(0.0, 1.0));
|
||||
}
|
||||
|
||||
return hslLight.toColor();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user