Skip to content

Commit f452053

Browse files
committed
content: Match code blocks' background and border colors to web
(Specifically by eliminating the border and using a particular shade of gray for the background.) Also the background of inline code, which in web uses the same CSS variable as the background color for code blocks.
1 parent d0ecda9 commit f452053

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/widgets/content.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,10 @@ class CodeBlock extends StatelessWidget {
491491

492492
final CodeBlockNode node;
493493

494-
static final _borderColor = const HSLColor.fromAHSL(0.15, 0, 0, 0).toColor();
495-
496494
@override
497495
Widget build(BuildContext context) {
498496
return _CodeBlockContainer(
499-
borderColor: _borderColor,
497+
borderColor: Colors.transparent,
500498
child: Text.rich(_buildNodes(node.spans)));
501499
}
502500

@@ -521,7 +519,7 @@ class _CodeBlockContainer extends StatelessWidget {
521519
Widget build(BuildContext context) {
522520
return Container(
523521
decoration: BoxDecoration(
524-
color: Colors.white,
522+
color: const HSLColor.fromAHSL(0.04, 0, 0, 0).toColor(),
525523
border: Border.all(
526524
width: 1,
527525
color: borderColor),
@@ -810,7 +808,6 @@ class _InlineContentBuilder {
810808
// TODO `code`: find equivalent of web's `unicode-bidi: embed; direction: ltr`
811809

812810
return _buildNodes(
813-
// Use a light gray background, instead of a border.
814811
style: widget.style
815812
.merge(_kInlineCodeStyle)
816813
.apply(fontSizeFactor: _kInlineCodeFontSizeFactor),
@@ -855,7 +852,8 @@ const _kInlineCodeFontSizeFactor = 0.825;
855852
// assuming the text gets the effect of [weightVariableTextStyle]
856853
// through inheritance, e.g., from a [DefaultTextStyle].
857854
final _kInlineCodeStyle = kMonospaceTextStyle
858-
.merge(const TextStyle(backgroundColor: Color(0xffeeeeee)));
855+
.merge(TextStyle(
856+
backgroundColor: const HSLColor.fromAHSL(0.04, 0, 0, 0).toColor()));
859857

860858
final _kCodeBlockStyle = kMonospaceTextStyle
861859
.merge(const TextStyle(fontSize: 0.825 * kBaseFontSize))

0 commit comments

Comments
 (0)