@@ -19,6 +19,10 @@ class CodeBlockTextStyles {
1919 height: 1.4 ))
2020 .merge (weightVariableTextStyle (context)),
2121
22+ // .highlight { background-color: hsl(51deg 100% 79%); }
23+ // See https://github.com/zulip/zulip/blob/f87479703/web/styles/rendered_markdown.css#L1037-L1039
24+ highlight: TextStyle (backgroundColor: const HSLColor .fromAHSL (1 , 51 , 1 , 0.79 ).toColor ()),
25+
2226 // .hll { background-color: hsl(60deg 100% 90%); }
2327 hll: TextStyle (backgroundColor: const HSLColor .fromAHSL (1 , 60 , 1 , 0.90 ).toColor ()),
2428
@@ -259,6 +263,10 @@ class CodeBlockTextStyles {
259263 height: 1.4 ))
260264 .merge (weightVariableTextStyle (context)),
261265
266+ // .highlight { background-color: hsl(51deg 100% 23%); }
267+ // See https://github.com/zulip/zulip/blob/f87479703/web/styles/dark_theme.css#L410-L412
268+ highlight: TextStyle (backgroundColor: const HSLColor .fromAHSL (1 , 51 , 1 , 0.23 ).toColor ()),
269+
262270 // .hll { background-color: #49483e; }
263271 hll: const TextStyle (backgroundColor: Color (0xff49483e )),
264272
@@ -500,6 +508,7 @@ class CodeBlockTextStyles {
500508
501509 CodeBlockTextStyles ._({
502510 required this .plain,
511+ required TextStyle highlight,
503512 required TextStyle hll,
504513 required TextStyle c,
505514 required TextStyle err,
@@ -580,6 +589,7 @@ class CodeBlockTextStyles {
580589 required TextStyle ? vm,
581590 required TextStyle il,
582591 }) :
592+ _highlight = highlight,
583593 _hll = hll,
584594 _c = c,
585595 _err = err,
@@ -663,6 +673,7 @@ class CodeBlockTextStyles {
663673 /// The baseline style that the [forSpan] styles get applied on top of.
664674 final TextStyle plain;
665675
676+ final TextStyle _highlight;
666677 final TextStyle _hll;
667678 final TextStyle _c;
668679 final TextStyle _err;
@@ -751,6 +762,7 @@ class CodeBlockTextStyles {
751762 TextStyle ? forSpan (CodeBlockSpanType type) {
752763 return switch (type) {
753764 CodeBlockSpanType .text => null , // A span with type of text is always unstyled.
765+ CodeBlockSpanType .highlight => _highlight,
754766 CodeBlockSpanType .highlightedLines => _hll,
755767 CodeBlockSpanType .comment => _c,
756768 CodeBlockSpanType .error => _err,
@@ -839,6 +851,7 @@ class CodeBlockTextStyles {
839851
840852 return CodeBlockTextStyles ._(
841853 plain: TextStyle .lerp (a.plain, b.plain, t)! ,
854+ highlight: TextStyle .lerp (a._highlight, b._highlight, t)! ,
842855 hll: TextStyle .lerp (a._hll, b._hll, t)! ,
843856 c: TextStyle .lerp (a._c, b._c, t)! ,
844857 err: TextStyle .lerp (a._err, b._err, t)! ,
0 commit comments