Skip to content

Commit d5afb4a

Browse files
committed
content [nfc]: Add ContentTheme.colorGlobalTimeBackground
The dark and light values come from the web app.
1 parent 60bcc63 commit d5afb4a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/widgets/content.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
3636
return ContentTheme._(
3737
colorCodeBlockBackground: const HSLColor.fromAHSL(0.04, 0, 0, 0).toColor(),
3838
colorDirectMentionBackground: const HSLColor.fromAHSL(0.2, 240, 0.7, 0.7).toColor(),
39+
colorGlobalTimeBackground: const HSLColor.fromAHSL(1, 0, 0, 0.93).toColor(),
3940
colorMathBlockBorder: const HSLColor.fromAHSL(0.15, 240, 0.8, 0.5).toColor(),
4041
colorMessageMediaContainerBackground: const Color.fromRGBO(0, 0, 0, 0.03),
4142
colorThematicBreak: const HSLColor.fromAHSL(1, 0, 0, .87).toColor(),
@@ -59,6 +60,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
5960
return ContentTheme._(
6061
colorCodeBlockBackground: const HSLColor.fromAHSL(0.04, 0, 0, 1).toColor(),
6162
colorDirectMentionBackground: const HSLColor.fromAHSL(0.25, 240, 0.52, 0.6).toColor(),
63+
colorGlobalTimeBackground: const HSLColor.fromAHSL(0.2, 0, 0, 0).toColor(),
6264
colorMathBlockBorder: const HSLColor.fromAHSL(1, 240, 0.4, 0.4).toColor(),
6365
colorMessageMediaContainerBackground: const HSLColor.fromAHSL(0.03, 0, 0, 1).toColor(),
6466
colorThematicBreak: const HSLColor.fromAHSL(1, 0, 0, .87).toColor().withOpacity(0.2),
@@ -81,6 +83,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
8183
ContentTheme._({
8284
required this.colorCodeBlockBackground,
8385
required this.colorDirectMentionBackground,
86+
required this.colorGlobalTimeBackground,
8487
required this.colorMathBlockBorder,
8588
required this.colorMessageMediaContainerBackground,
8689
required this.colorThematicBreak,
@@ -104,6 +107,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
104107

105108
final Color colorCodeBlockBackground;
106109
final Color colorDirectMentionBackground;
110+
final Color colorGlobalTimeBackground;
107111
final Color colorMathBlockBorder; // TODO(#46) this won't be needed
108112
final Color colorMessageMediaContainerBackground;
109113
final Color colorThematicBreak;
@@ -153,6 +157,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
153157
ContentTheme copyWith({
154158
Color? colorCodeBlockBackground,
155159
Color? colorDirectMentionBackground,
160+
Color? colorGlobalTimeBackground,
156161
Color? colorMathBlockBorder,
157162
Color? colorMessageMediaContainerBackground,
158163
Color? colorThematicBreak,
@@ -166,6 +171,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
166171
return ContentTheme._(
167172
colorCodeBlockBackground: colorCodeBlockBackground ?? this.colorCodeBlockBackground,
168173
colorDirectMentionBackground: colorDirectMentionBackground ?? this.colorDirectMentionBackground,
174+
colorGlobalTimeBackground: colorGlobalTimeBackground ?? this.colorGlobalTimeBackground,
169175
colorMathBlockBorder: colorMathBlockBorder ?? this.colorMathBlockBorder,
170176
colorMessageMediaContainerBackground: colorMessageMediaContainerBackground ?? this.colorMessageMediaContainerBackground,
171177
colorThematicBreak: colorThematicBreak ?? this.colorThematicBreak,
@@ -186,6 +192,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
186192
return ContentTheme._(
187193
colorCodeBlockBackground: Color.lerp(colorCodeBlockBackground, other.colorCodeBlockBackground, t)!,
188194
colorDirectMentionBackground: Color.lerp(colorDirectMentionBackground, other.colorDirectMentionBackground, t)!,
195+
colorGlobalTimeBackground: Color.lerp(colorGlobalTimeBackground, other.colorGlobalTimeBackground, t)!,
189196
colorMathBlockBorder: Color.lerp(colorMathBlockBorder, other.colorMathBlockBorder, t)!,
190197
colorMessageMediaContainerBackground: Color.lerp(colorMessageMediaContainerBackground, other.colorMessageMediaContainerBackground, t)!,
191198
colorThematicBreak: Color.lerp(colorThematicBreak, other.colorThematicBreak, t)!,
@@ -1117,7 +1124,6 @@ class GlobalTime extends StatelessWidget {
11171124
final GlobalTimeNode node;
11181125
final TextStyle ambientTextStyle;
11191126

1120-
static final _backgroundColor = const HSLColor.fromAHSL(1, 0, 0, 0.93).toColor();
11211127
static final _borderColor = const HSLColor.fromAHSL(1, 0, 0, 0.8).toColor();
11221128
static final _dateFormat = DateFormat('EEE, MMM d, y, h:mm a'); // TODO(intl): localize date
11231129

@@ -1126,11 +1132,12 @@ class GlobalTime extends StatelessWidget {
11261132
// Design taken from css for `.rendered_markdown & time` in web,
11271133
// see zulip:web/styles/rendered_markdown.css .
11281134
final text = _dateFormat.format(node.datetime.toLocal());
1135+
final contentTheme = ContentTheme.of(context);
11291136
return Padding(
11301137
padding: const EdgeInsets.symmetric(horizontal: 2),
11311138
child: DecoratedBox(
11321139
decoration: BoxDecoration(
1133-
color: _backgroundColor,
1140+
color: contentTheme.colorGlobalTimeBackground,
11341141
border: Border.all(width: 1, color: _borderColor),
11351142
borderRadius: BorderRadius.circular(3)),
11361143
child: Padding(

0 commit comments

Comments
 (0)