From 01bd3a6d3c99781513761cdf081ab4855a8bb5b9 Mon Sep 17 00:00:00 2001 From: cogwheel0 <172976095+cogwheel0@users.noreply.github.com> Date: Fri, 3 Oct 2025 00:18:48 +0530 Subject: [PATCH] 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. --- lib/shared/theme/color_tokens.dart | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/shared/theme/color_tokens.dart b/lib/shared/theme/color_tokens.dart index f95056b..df5d96b 100644 --- a/lib/shared/theme/color_tokens.dart +++ b/lib/shared/theme/color_tokens.dart @@ -146,15 +146,6 @@ class AppColorTokens extends ThemeExtension { ? 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 { 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,