@@ -19,6 +19,10 @@ class CodeBlockTextStyles {
19
19
height: 1.4 ))
20
20
.merge (weightVariableTextStyle (context)),
21
21
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
+
22
26
// .hll { background-color: hsl(60deg 100% 90%); }
23
27
hll: TextStyle (backgroundColor: const HSLColor .fromAHSL (1 , 60 , 1 , 0.90 ).toColor ()),
24
28
@@ -259,6 +263,10 @@ class CodeBlockTextStyles {
259
263
height: 1.4 ))
260
264
.merge (weightVariableTextStyle (context)),
261
265
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
+
262
270
// .hll { background-color: #49483e; }
263
271
hll: const TextStyle (backgroundColor: Color (0xff49483e )),
264
272
@@ -500,6 +508,7 @@ class CodeBlockTextStyles {
500
508
501
509
CodeBlockTextStyles ._({
502
510
required this .plain,
511
+ required TextStyle highlight,
503
512
required TextStyle hll,
504
513
required TextStyle c,
505
514
required TextStyle err,
@@ -580,6 +589,7 @@ class CodeBlockTextStyles {
580
589
required TextStyle ? vm,
581
590
required TextStyle il,
582
591
}) :
592
+ _highlight = highlight,
583
593
_hll = hll,
584
594
_c = c,
585
595
_err = err,
@@ -663,6 +673,7 @@ class CodeBlockTextStyles {
663
673
/// The baseline style that the [forSpan] styles get applied on top of.
664
674
final TextStyle plain;
665
675
676
+ final TextStyle _highlight;
666
677
final TextStyle _hll;
667
678
final TextStyle _c;
668
679
final TextStyle _err;
@@ -751,6 +762,7 @@ class CodeBlockTextStyles {
751
762
TextStyle ? forSpan (CodeBlockSpanType type) {
752
763
return switch (type) {
753
764
CodeBlockSpanType .text => null , // A span with type of text is always unstyled.
765
+ CodeBlockSpanType .highlight => _highlight,
754
766
CodeBlockSpanType .highlightedLines => _hll,
755
767
CodeBlockSpanType .comment => _c,
756
768
CodeBlockSpanType .error => _err,
@@ -839,6 +851,7 @@ class CodeBlockTextStyles {
839
851
840
852
return CodeBlockTextStyles ._(
841
853
plain: TextStyle .lerp (a.plain, b.plain, t)! ,
854
+ highlight: TextStyle .lerp (a._highlight, b._highlight, t)! ,
842
855
hll: TextStyle .lerp (a._hll, b._hll, t)! ,
843
856
c: TextStyle .lerp (a._c, b._c, t)! ,
844
857
err: TextStyle .lerp (a._err, b._err, t)! ,
0 commit comments