reorganize app colors

This commit is contained in:
Fabian Freund
2026-01-11 19:05:18 +01:00
parent edbc157c46
commit 01d145bd72
17 changed files with 152 additions and 62 deletions
+76 -12
View File
@@ -1,21 +1,85 @@
import 'package:flutter/material.dart';
class AppColors {
AppColors._();
@immutable
class AppColors extends ThemeExtension<AppColors> {
const AppColors._({
this.seedColor = const Color(0xFF167C80),
this.privateTabPurple = const Color(0xFF8000D7),
this.privateTabBackground = const Color(0xFF25003E),
this.privateSelectionOverlay = const Color(0x648000D7),
this.torPurple = const Color(0xFF7D4698),
this.torActiveGreen = const Color(0xFF68B030),
this.torBackgroundGrey = const Color(0xFF333A41),
});
static const Color seedColor = Color(0xFF167C80);
final Color seedColor;
final Color privateTabPurple;
final Color privateTabBackground;
final Color privateSelectionOverlay;
final Color torPurple;
final Color torActiveGreen;
final Color torBackgroundGrey;
static const Color privateTabPurple = Color(0xFF8000D7);
static const light = AppColors._();
static const dark = AppColors._();
static const Color privateTabBackground = Color(0xFF25003E);
@override
AppColors copyWith({
Color? seedColor,
Color? privateTabPurple,
Color? privateTabBackground,
Color? privateSelectionOverlay,
Color? torPurple,
Color? torActiveGreen,
Color? torBackgroundGrey,
}) {
return AppColors._(
seedColor: seedColor ?? this.seedColor,
privateTabPurple: privateTabPurple ?? this.privateTabPurple,
privateTabBackground: privateTabBackground ?? this.privateTabBackground,
privateSelectionOverlay:
privateSelectionOverlay ?? this.privateSelectionOverlay,
torPurple: torPurple ?? this.torPurple,
torActiveGreen: torActiveGreen ?? this.torActiveGreen,
torBackgroundGrey: torBackgroundGrey ?? this.torBackgroundGrey,
);
}
static const Color privateSelectionOverlay = Color(0x648000D7);
@override
AppColors lerp(covariant ThemeExtension<AppColors>? other, double t) {
if (other is! AppColors) {
return this;
}
static const Color torPurple = Color(0xFF7D4698);
return AppColors._(
seedColor: Color.lerp(seedColor, other.seedColor, t)!,
privateTabPurple: Color.lerp(
privateTabPurple,
other.privateTabPurple,
t,
)!,
privateTabBackground: Color.lerp(
privateTabBackground,
other.privateTabBackground,
t,
)!,
privateSelectionOverlay: Color.lerp(
privateSelectionOverlay,
other.privateSelectionOverlay,
t,
)!,
torPurple: Color.lerp(torPurple, other.torPurple, t)!,
torActiveGreen: Color.lerp(torActiveGreen, other.torActiveGreen, t)!,
torBackgroundGrey: Color.lerp(
torBackgroundGrey,
other.torBackgroundGrey,
t,
)!,
);
}
static const Color torActiveGreen = Color(0xFF68B030);
static const Color torBackgroundGrey = Color(0xFF333A41);
static const Color dialogOverlay = Color(0x44000000);
/// Get AppColors from the current theme
static AppColors of(BuildContext context) {
return Theme.of(context).extension<AppColors>() ?? light;
}
}