refactor: Simplify AppPalette color definitions and gradients for improved readability

This commit is contained in:
2026-05-23 18:28:43 +02:00
parent 7c1d4e5fd8
commit d849c25ed6
+78 -96
View File
@@ -25,70 +25,6 @@ class AppPalette extends ThemeExtension<AppPalette> {
Colors.orange,
];
static const Gradient _darkBackdropGradient = LinearGradient(
colors: <Color>[Color(0xFF191A1D), Color(0xFF222326), Color(0xFF101114)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
);
static const Gradient _lightBackdropGradient = LinearGradient(
colors: <Color>[Color(0xFFFFFFFF), Color(0xFFF2F4F6), Color(0xFFECEFF1)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
);
static const Color _darkDrawerBackground = Color.fromARGB(255, 30, 31, 35);
static const Color _lightDrawerBackground = Color(0xFFF7F9FA);
static const Color _darkCardBackground = Color.fromRGBO(24, 25, 26, 1);
static const Color _lightCardBackground = Color(0xFFFFFFFF);
static const Color _darkSurfaceElevated = Color(0xFF303134);
static const Color _lightSurfaceElevated = Color(0xFFF0F2F4);
static const Color _darkBorder = Color.fromRGBO(255, 255, 255, 0.12);
static const Color _lightBorder = Color.fromRGBO(15, 23, 32, 0.06);
static const Color _darkBorderMuted = Color.fromRGBO(255, 255, 255, 0.08);
static const Color _lightBorderMuted = Color.fromRGBO(15, 23, 32, 0.03);
static const Color _darkTextPrimary = Colors.white;
static const Color _lightTextPrimary = Color(0xFF0F1720);
static const Color _darkTextSecondary = Colors.white70;
static const Color _lightTextSecondary = Color(0xFF374151);
static const Color _darkTextOnSurfaceDark = Colors.black87;
static const Color _lightTextOnSurfaceDark = Colors.black87;
static const Color _darkTextMuted = Colors.white54;
static const Color _lightTextMuted = Color(0xFF6B7280);
static const Color _darkTextDisabled = Colors.white24;
static const Color _lightTextDisabled = Color(0xFFBDBDBD);
static const Color _darkTextHint = Color.fromRGBO(255, 255, 255, 0.30);
static const Color _lightTextHint = Color.fromRGBO(15, 23, 32, 0.30);
static const Color _darkFill = Color.fromRGBO(255, 255, 255, 0.05);
static const Color _lightFill = Color.fromRGBO(15, 23, 32, 0.02);
static const Color _darkHover = Color.fromRGBO(255, 255, 255, 0.10);
static const Color _lightHover = Color.fromRGBO(15, 23, 32, 0.04);
static const Color _darkShadowSoft = Color.fromRGBO(0, 0, 0, 0.25);
static const Color _lightShadowSoft = Color.fromRGBO(0, 0, 0, 0.08);
static const Color _darkShadowDim = Color.fromARGB(54, 0, 0, 0);
static const Color _lightShadowDim = Color.fromARGB(40, 0, 0, 0);
static const Color _darkAccent = Colors.amber;
static const Color _lightAccent = Colors.blue;
static const Color _darkTextOnAccent = Colors.black;
static const Color _lightTextOnAccent = Colors.white;
static const Color _darkOverlay = Color.fromARGB(140, 0, 0, 0);
static const Color _lightOverlay = Color.fromARGB(120, 0, 0, 0);
static const Color _transparent = Colors.transparent;
static const Color _darkDragTargetBorder = Color(0xFF42A5F5);
static const Color _lightDragTargetBorder = Color(0xFF1565C0);
static const Color _darkSyncPreparing = Color.fromARGB(255, 165, 165, 165);
static const Color _lightSyncPreparing = Color.fromARGB(255, 120, 120, 120);
static const Color _darkSyncEncrypting = Color.fromARGB(255, 109, 191, 255);
static const Color _lightSyncEncrypting = Color.fromARGB(255, 2, 136, 209);
static const Color _darkSyncUploading = Color.fromARGB(255, 98, 190, 255);
static const Color _lightSyncUploading = Color.fromARGB(255, 2, 119, 189);
static const Color _darkSyncWaiting = Color.fromARGB(255, 150, 150, 150);
static const Color _lightSyncWaiting = Color.fromARGB(255, 150, 150, 150);
static const Color _darkSyncDecrypting = Color.fromARGB(255, 154, 194, 112);
static const Color _lightSyncDecrypting = Color.fromARGB(255, 76, 175, 80);
static const Color _darkSuccess = Colors.green;
static const Color _lightSuccess = Colors.green;
const AppPalette({
required this.backdropGradient,
required this.drawerBackground,
@@ -280,42 +216,88 @@ class AppPalette extends ThemeExtension<AppPalette> {
final bool isLight = brightness == Brightness.light;
return AppPalette(
backdropGradient: isLight
? _lightBackdropGradient
: _darkBackdropGradient,
? const LinearGradient(
colors: <Color>[
Color(0xFFFFFFFF),
Color(0xFFF2F4F6),
Color(0xFFECEFF1),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
)
: const LinearGradient(
colors: <Color>[
Color(0xFF191A1D),
Color(0xFF222326),
Color(0xFF101114),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
drawerBackground: isLight
? _lightDrawerBackground
: _darkDrawerBackground,
cardBackground: isLight ? _lightCardBackground : _darkCardBackground,
? const Color(0xFFF7F9FA)
: const Color.fromARGB(255, 30, 31, 35),
cardBackground: isLight
? const Color(0xFFFFFFFF)
: const Color.fromRGBO(24, 25, 26, 1),
categoryColors: defaultCategoryColors,
surfaceElevated: isLight ? _lightSurfaceElevated : _darkSurfaceElevated,
border: isLight ? _lightBorder : _darkBorder,
borderMuted: isLight ? _lightBorderMuted : _darkBorderMuted,
accent: seedColor ?? (isLight ? _lightAccent : _darkAccent),
textPrimary: isLight ? _lightTextPrimary : _darkTextPrimary,
textSecondary: isLight ? _lightTextSecondary : _darkTextSecondary,
textOnSurfaceDark: isLight
? _lightTextOnSurfaceDark
: _darkTextOnSurfaceDark,
textMuted: isLight ? _lightTextMuted : _darkTextMuted,
textDisabled: isLight ? _lightTextDisabled : _darkTextDisabled,
textHint: isLight ? _lightTextHint : _darkTextHint,
fill: isLight ? _lightFill : _darkFill,
hover: isLight ? _lightHover : _darkHover,
shadowSoft: isLight ? _lightShadowSoft : _darkShadowSoft,
shadowDim: isLight ? _lightShadowDim : _darkShadowDim,
surfaceElevated: isLight
? const Color(0xFFF0F2F4)
: const Color(0xFF303134),
border: isLight
? const Color.fromRGBO(15, 23, 32, 0.06)
: const Color.fromRGBO(255, 255, 255, 0.12),
borderMuted: isLight
? const Color.fromRGBO(15, 23, 32, 0.03)
: const Color.fromRGBO(255, 255, 255, 0.08),
accent:
seedColor ??
(isLight
? AppPalette.lightDefaultThemeSeedColor
: AppPalette.darkDefaultThemeSeedColor),
textPrimary: isLight ? const Color(0xFF0F1720) : Colors.white,
textSecondary: isLight ? const Color(0xFF374151) : Colors.white70,
textOnSurfaceDark: isLight ? Colors.black87 : Colors.black87,
textMuted: isLight ? const Color(0xFF6B7280) : Colors.white54,
textDisabled: isLight ? const Color(0xFFBDBDBD) : Colors.white24,
textHint: isLight
? const Color.fromRGBO(15, 23, 32, 0.30)
: const Color.fromRGBO(255, 255, 255, 0.30),
fill: isLight
? const Color.fromRGBO(15, 23, 32, 0.02)
: const Color.fromRGBO(255, 255, 255, 0.05),
hover: isLight
? const Color.fromRGBO(15, 23, 32, 0.04)
: const Color.fromRGBO(255, 255, 255, 0.10),
shadowSoft: isLight
? const Color.fromRGBO(0, 0, 0, 0.08)
: const Color.fromRGBO(0, 0, 0, 0.25),
shadowDim: isLight
? const Color.fromARGB(40, 0, 0, 0)
: const Color.fromARGB(54, 0, 0, 0),
destructiveAccent: Colors.redAccent,
textOnAccent: isLight ? _lightTextOnAccent : _darkTextOnAccent,
overlay: isLight ? _lightOverlay : _darkOverlay,
transparent: _transparent,
textOnAccent: isLight ? Colors.white : Colors.black,
overlay: isLight
? const Color.fromARGB(120, 0, 0, 0)
: const Color.fromARGB(140, 0, 0, 0),
transparent: Colors.transparent,
dragTargetBorder: isLight
? _lightDragTargetBorder
: _darkDragTargetBorder,
syncPreparing: isLight ? _lightSyncPreparing : _darkSyncPreparing,
syncEncrypting: isLight ? _lightSyncEncrypting : _darkSyncEncrypting,
syncUploading: isLight ? _lightSyncUploading : _darkSyncUploading,
syncWaiting: isLight ? _lightSyncWaiting : _darkSyncWaiting,
syncDecrypting: isLight ? _lightSyncDecrypting : _darkSyncDecrypting,
success: isLight ? _lightSuccess : _darkSuccess,
? const Color(0xFF1565C0)
: const Color(0xFF42A5F5),
syncPreparing: isLight
? const Color.fromARGB(255, 120, 120, 120)
: const Color.fromARGB(255, 165, 165, 165),
syncEncrypting: isLight
? const Color.fromARGB(255, 2, 136, 209)
: const Color.fromARGB(255, 109, 191, 255),
syncUploading: isLight
? const Color.fromARGB(255, 2, 119, 189)
: const Color.fromARGB(255, 98, 190, 255),
syncWaiting: const Color.fromARGB(255, 150, 150, 150),
syncDecrypting: isLight
? const Color.fromARGB(255, 76, 175, 80)
: const Color.fromARGB(255, 154, 194, 112),
success: Colors.green,
);
}
}