refactor: update color tokens for improved theme adaptability

- Replaced hardcoded color values for code background, border, text, and accent with dynamic tokens based on the current theme.
- Enhanced the use of neutral tones to ensure better visual consistency across light and dark themes.
- Improved overall maintainability of the color token definitions by centralizing theme-related logic.
This commit is contained in:
cogwheel0
2025-10-03 00:18:48 +05:30
parent 1ea85d5ed1
commit 01bd3a6d3c

View File

@@ -146,15 +146,6 @@ class AppColorTokens extends ThemeExtension<AppColorTokens> {
? const Color.fromRGBO(21, 25, 32, 0.32)
: const Color.fromRGBO(232, 236, 245, 0.48);
final Color codeBackground = isLight
? const Color(0xFF0F172A)
: const Color(0xFF111828);
final Color codeBorder = isLight
? const Color(0xFF1E293B)
: const Color(0xFF1F2937);
final Color codeText = const Color(0xFFE2E8F0);
final Color codeAccent = codeBorder;
final ColorScheme seedScheme = ColorScheme.fromSeed(
seedColor: tone.primary,
brightness: brightness,
@@ -225,6 +216,13 @@ class AppColorTokens extends ThemeExtension<AppColorTokens> {
dark: neutralOnSurface,
);
final Color codeBackground = isLight ? neutralTone10 : neutralTone00;
final Color codeBorder = isLight ? neutralTone20 : neutralTone40;
final Color codeText = neutralOnSurface;
final Color codeAccent = isLight
? Color.alphaBlend(brandTone60.withValues(alpha: 0.14), codeBackground)
: Color.alphaBlend(brandTone40.withValues(alpha: 0.24), codeBackground);
return AppColorTokens(
brightness: brightness,
neutralTone00: neutralTone00,