@@ -34,6 +34,7 @@ import 'text.dart';
34
34
class ContentTheme extends ThemeExtension <ContentTheme > {
35
35
factory ContentTheme .light (BuildContext context) {
36
36
return ContentTheme ._(
37
+ colorCodeBlockBackground: const HSLColor .fromAHSL (0.04 , 0 , 0 , 0 ).toColor (),
37
38
colorMessageMediaContainerBackground: const Color .fromRGBO (0 , 0 , 0 , 0.03 ),
38
39
colorThematicBreak: const HSLColor .fromAHSL (1 , 0 , 0 , .87 ).toColor (),
39
40
textStylePlainParagraph: _plainParagraphCommon (context).copyWith (
@@ -49,6 +50,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
49
50
50
51
factory ContentTheme .dark (BuildContext context) {
51
52
return ContentTheme ._(
53
+ colorCodeBlockBackground: const HSLColor .fromAHSL (0.04 , 0 , 0 , 1 ).toColor (),
52
54
colorMessageMediaContainerBackground: const HSLColor .fromAHSL (0.03 , 0 , 0 , 1 ).toColor (),
53
55
colorThematicBreak: const HSLColor .fromAHSL (1 , 0 , 0 , .87 ).toColor ().withOpacity (0.2 ),
54
56
textStylePlainParagraph: _plainParagraphCommon (context).copyWith (
@@ -63,6 +65,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
63
65
}
64
66
65
67
ContentTheme ._({
68
+ required this .colorCodeBlockBackground,
66
69
required this .colorMessageMediaContainerBackground,
67
70
required this .colorThematicBreak,
68
71
required this .textStylePlainParagraph,
@@ -81,6 +84,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
81
84
return extension ! ;
82
85
}
83
86
87
+ final Color colorCodeBlockBackground;
84
88
final Color colorMessageMediaContainerBackground;
85
89
final Color colorThematicBreak;
86
90
@@ -113,6 +117,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
113
117
114
118
@override
115
119
ContentTheme copyWith ({
120
+ Color ? colorCodeBlockBackground,
116
121
Color ? colorMessageMediaContainerBackground,
117
122
Color ? colorThematicBreak,
118
123
TextStyle ? textStylePlainParagraph,
@@ -121,6 +126,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
121
126
TextStyle ? textStyleErrorCode,
122
127
}) {
123
128
return ContentTheme ._(
129
+ colorCodeBlockBackground: colorCodeBlockBackground ?? this .colorCodeBlockBackground,
124
130
colorMessageMediaContainerBackground: colorMessageMediaContainerBackground ?? this .colorMessageMediaContainerBackground,
125
131
colorThematicBreak: colorThematicBreak ?? this .colorThematicBreak,
126
132
textStylePlainParagraph: textStylePlainParagraph ?? this .textStylePlainParagraph,
@@ -136,6 +142,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
136
142
return this ;
137
143
}
138
144
return ContentTheme ._(
145
+ colorCodeBlockBackground: Color .lerp (colorCodeBlockBackground, other.colorCodeBlockBackground, t)! ,
139
146
colorMessageMediaContainerBackground: Color .lerp (colorMessageMediaContainerBackground, other.colorMessageMediaContainerBackground, t)! ,
140
147
colorThematicBreak: Color .lerp (colorThematicBreak, other.colorThematicBreak, t)! ,
141
148
textStylePlainParagraph: TextStyle .lerp (textStylePlainParagraph, other.textStylePlainParagraph, t)! ,
@@ -646,7 +653,7 @@ class _CodeBlockContainer extends StatelessWidget {
646
653
Widget build (BuildContext context) {
647
654
return Container (
648
655
decoration: BoxDecoration (
649
- color: const HSLColor . fromAHSL ( 0.04 , 0 , 0 , 0 ). toColor () ,
656
+ color: ContentTheme . of (context).colorCodeBlockBackground ,
650
657
border: Border .all (
651
658
width: 1 ,
652
659
color: borderColor),
0 commit comments