From fb01562301d12f7b98ce3ccef47fc5cb968af8f3 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Tue, 25 Jun 2024 22:46:19 -0700 Subject: [PATCH] content [nfc]: Add ContentTheme.colorGlobalTimeBorder The dark and light values come from the web app. This completes the sweep through message-content colors for #95 dark theme. They are all either in ContentTheme with light/dark variants, or still inline but with a comment explaining that they don't need light/dark variants. --- lib/widgets/content.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/widgets/content.dart b/lib/widgets/content.dart index 1715d41e7b..43c747232d 100644 --- a/lib/widgets/content.dart +++ b/lib/widgets/content.dart @@ -37,6 +37,7 @@ class ContentTheme extends ThemeExtension { colorCodeBlockBackground: const HSLColor.fromAHSL(0.04, 0, 0, 0).toColor(), colorDirectMentionBackground: const HSLColor.fromAHSL(0.2, 240, 0.7, 0.7).toColor(), colorGlobalTimeBackground: const HSLColor.fromAHSL(1, 0, 0, 0.93).toColor(), + colorGlobalTimeBorder: const HSLColor.fromAHSL(1, 0, 0, 0.8).toColor(), colorMathBlockBorder: const HSLColor.fromAHSL(0.15, 240, 0.8, 0.5).toColor(), colorMessageMediaContainerBackground: const Color.fromRGBO(0, 0, 0, 0.03), colorThematicBreak: const HSLColor.fromAHSL(1, 0, 0, .87).toColor(), @@ -61,6 +62,7 @@ class ContentTheme extends ThemeExtension { colorCodeBlockBackground: const HSLColor.fromAHSL(0.04, 0, 0, 1).toColor(), colorDirectMentionBackground: const HSLColor.fromAHSL(0.25, 240, 0.52, 0.6).toColor(), colorGlobalTimeBackground: const HSLColor.fromAHSL(0.2, 0, 0, 0).toColor(), + colorGlobalTimeBorder: const HSLColor.fromAHSL(0.4, 0, 0, 0).toColor(), colorMathBlockBorder: const HSLColor.fromAHSL(1, 240, 0.4, 0.4).toColor(), colorMessageMediaContainerBackground: const HSLColor.fromAHSL(0.03, 0, 0, 1).toColor(), colorThematicBreak: const HSLColor.fromAHSL(1, 0, 0, .87).toColor().withOpacity(0.2), @@ -84,6 +86,7 @@ class ContentTheme extends ThemeExtension { required this.colorCodeBlockBackground, required this.colorDirectMentionBackground, required this.colorGlobalTimeBackground, + required this.colorGlobalTimeBorder, required this.colorMathBlockBorder, required this.colorMessageMediaContainerBackground, required this.colorThematicBreak, @@ -108,6 +111,7 @@ class ContentTheme extends ThemeExtension { final Color colorCodeBlockBackground; final Color colorDirectMentionBackground; final Color colorGlobalTimeBackground; + final Color colorGlobalTimeBorder; final Color colorMathBlockBorder; // TODO(#46) this won't be needed final Color colorMessageMediaContainerBackground; final Color colorThematicBreak; @@ -158,6 +162,7 @@ class ContentTheme extends ThemeExtension { Color? colorCodeBlockBackground, Color? colorDirectMentionBackground, Color? colorGlobalTimeBackground, + Color? colorGlobalTimeBorder, Color? colorMathBlockBorder, Color? colorMessageMediaContainerBackground, Color? colorThematicBreak, @@ -172,6 +177,7 @@ class ContentTheme extends ThemeExtension { colorCodeBlockBackground: colorCodeBlockBackground ?? this.colorCodeBlockBackground, colorDirectMentionBackground: colorDirectMentionBackground ?? this.colorDirectMentionBackground, colorGlobalTimeBackground: colorGlobalTimeBackground ?? this.colorGlobalTimeBackground, + colorGlobalTimeBorder: colorGlobalTimeBorder ?? this.colorGlobalTimeBorder, colorMathBlockBorder: colorMathBlockBorder ?? this.colorMathBlockBorder, colorMessageMediaContainerBackground: colorMessageMediaContainerBackground ?? this.colorMessageMediaContainerBackground, colorThematicBreak: colorThematicBreak ?? this.colorThematicBreak, @@ -193,6 +199,7 @@ class ContentTheme extends ThemeExtension { colorCodeBlockBackground: Color.lerp(colorCodeBlockBackground, other.colorCodeBlockBackground, t)!, colorDirectMentionBackground: Color.lerp(colorDirectMentionBackground, other.colorDirectMentionBackground, t)!, colorGlobalTimeBackground: Color.lerp(colorGlobalTimeBackground, other.colorGlobalTimeBackground, t)!, + colorGlobalTimeBorder: Color.lerp(colorGlobalTimeBorder, other.colorGlobalTimeBorder, t)!, colorMathBlockBorder: Color.lerp(colorMathBlockBorder, other.colorMathBlockBorder, t)!, colorMessageMediaContainerBackground: Color.lerp(colorMessageMediaContainerBackground, other.colorMessageMediaContainerBackground, t)!, colorThematicBreak: Color.lerp(colorThematicBreak, other.colorThematicBreak, t)!, @@ -1124,7 +1131,6 @@ class GlobalTime extends StatelessWidget { final GlobalTimeNode node; final TextStyle ambientTextStyle; - static final _borderColor = const HSLColor.fromAHSL(1, 0, 0, 0.8).toColor(); static final _dateFormat = DateFormat('EEE, MMM d, y, h:mm a'); // TODO(intl): localize date @override @@ -1138,7 +1144,7 @@ class GlobalTime extends StatelessWidget { child: DecoratedBox( decoration: BoxDecoration( color: contentTheme.colorGlobalTimeBackground, - border: Border.all(width: 1, color: _borderColor), + border: Border.all(width: 1, color: contentTheme.colorGlobalTimeBorder), borderRadius: BorderRadius.circular(3)), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 0.2 * kBaseFontSize),