Skip to content

Commit e1df51b

Browse files
content [nfc]: Move link color to ContentTheme.colorLink
1 parent efcf201 commit e1df51b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/widgets/content.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
5151
colorTableCellBorder: const HSLColor.fromAHSL(1, 0, 0, 0.80).toColor(),
5252
colorTableHeaderBackground: const HSLColor.fromAHSL(1, 0, 0, 0.93).toColor(),
5353
colorThematicBreak: const HSLColor.fromAHSL(1, 0, 0, .87).toColor(),
54+
colorLink: const HSLColor.fromAHSL(1, 200, 1, 0.4).toColor(),
5455
textStylePlainParagraph: _plainParagraphCommon(context).copyWith(
5556
color: const HSLColor.fromAHSL(1, 0, 0, 0.15).toColor(),
5657
debugLabel: 'ContentTheme.textStylePlainParagraph'),
@@ -84,6 +85,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
8485
colorTableCellBorder: const HSLColor.fromAHSL(1, 0, 0, 0.33).toColor(),
8586
colorTableHeaderBackground: const HSLColor.fromAHSL(0.5, 0, 0, 0).toColor(),
8687
colorThematicBreak: const HSLColor.fromAHSL(1, 0, 0, .87).toColor().withValues(alpha: 0.2),
88+
colorLink: const HSLColor.fromAHSL(1, 200, 1, 0.4).toColor(), // the same as light in Web
8789
textStylePlainParagraph: _plainParagraphCommon(context).copyWith(
8890
color: const HSLColor.fromAHSL(1, 0, 0, 0.85).toColor(),
8991
debugLabel: 'ContentTheme.textStylePlainParagraph'),
@@ -116,6 +118,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
116118
required this.colorTableCellBorder,
117119
required this.colorTableHeaderBackground,
118120
required this.colorThematicBreak,
121+
required this.colorLink,
119122
required this.textStylePlainParagraph,
120123
required this.textStyleEmoji,
121124
required this.codeBlockTextStyles,
@@ -148,6 +151,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
148151
final Color colorTableCellBorder;
149152
final Color colorTableHeaderBackground;
150153
final Color colorThematicBreak;
154+
final Color colorLink;
151155

152156
/// The complete [TextStyle] we use for plain, unstyled paragraphs.
153157
///
@@ -208,6 +212,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
208212
Color? colorTableCellBorder,
209213
Color? colorTableHeaderBackground,
210214
Color? colorThematicBreak,
215+
Color? colorLink,
211216
TextStyle? textStylePlainParagraph,
212217
TextStyle? textStyleEmoji,
213218
CodeBlockTextStyles? codeBlockTextStyles,
@@ -230,6 +235,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
230235
colorTableCellBorder: colorTableCellBorder ?? this.colorTableCellBorder,
231236
colorTableHeaderBackground: colorTableHeaderBackground ?? this.colorTableHeaderBackground,
232237
colorThematicBreak: colorThematicBreak ?? this.colorThematicBreak,
238+
colorLink: colorLink ?? this.colorLink,
233239
textStylePlainParagraph: textStylePlainParagraph ?? this.textStylePlainParagraph,
234240
textStyleEmoji: textStyleEmoji ?? this.textStyleEmoji,
235241
codeBlockTextStyles: codeBlockTextStyles ?? this.codeBlockTextStyles,
@@ -259,6 +265,7 @@ class ContentTheme extends ThemeExtension<ContentTheme> {
259265
colorTableCellBorder: Color.lerp(colorTableCellBorder, other.colorTableCellBorder, t)!,
260266
colorTableHeaderBackground: Color.lerp(colorTableHeaderBackground, other.colorTableHeaderBackground, t)!,
261267
colorThematicBreak: Color.lerp(colorThematicBreak, other.colorThematicBreak, t)!,
268+
colorLink: Color.lerp(colorLink, other.colorLink, t)!,
262269
textStylePlainParagraph: TextStyle.lerp(textStylePlainParagraph, other.textStylePlainParagraph, t)!,
263270
textStyleEmoji: TextStyle.lerp(textStyleEmoji, other.textStyleEmoji, t)!,
264271
codeBlockTextStyles: CodeBlockTextStyles.lerp(codeBlockTextStyles, other.codeBlockTextStyles, t),
@@ -1030,7 +1037,7 @@ class _InlineContentBuilder {
10301037
_pushRecognizer(recognizer);
10311038
final result = _buildNodes(node.nodes,
10321039
// Web has the same color in light and dark mode.
1033-
style: TextStyle(color: const HSLColor.fromAHSL(1, 200, 1, 0.4).toColor()));
1040+
style: TextStyle(color: ContentTheme.of(_context!).colorLink));
10341041
_popRecognizer();
10351042
return result;
10361043

0 commit comments

Comments
 (0)