@@ -100,8 +100,8 @@ std::thread_local! {
100100
101101#[ derive( Debug , Default , PartialEq , Clone , Copy ) ]
102102struct Brush {
103- /// When set, this overrides the fill/stroke to use this color for just a fill, for selection .
104- selection_fill_color : Option < crate :: Color > ,
103+ /// When set, this overrides the fill/stroke to use this color.
104+ override_fill_color : Option < Color > ,
105105 stroke : Option < TextStrokeStyle > ,
106106 link_color : Option < crate :: Color > ,
107107}
@@ -220,8 +220,8 @@ fn layout(text: Text, scale_factor: ScaleFactor, mut options: LayoutOptions) ->
220220 } ) ) ;
221221
222222 builder. push_default ( parley:: StyleProperty :: Brush ( Brush {
223- selection_fill_color : None ,
224- stroke : options . stroke ,
223+ override_fill_color : None ,
224+ stroke : self . stroke ,
225225 link_color : None ,
226226 } ) ) ;
227227 } ;
@@ -271,8 +271,8 @@ fn layout(text: Text, scale_factor: ScaleFactor, mut options: LayoutOptions) ->
271271 let local_selection = ( sel_start - range. start ) ..( sel_end - range. start ) ;
272272 builder. push (
273273 parley:: StyleProperty :: Brush ( Brush {
274- selection_fill_color : Some ( selection_color) ,
275- stroke : options . stroke ,
274+ override_fill_color : Some ( selection_color) ,
275+ stroke : self . stroke ,
276276 link_color : None ,
277277 } ) ,
278278 local_selection,
@@ -314,14 +314,23 @@ fn layout(text: Text, scale_factor: ScaleFactor, mut options: LayoutOptions) ->
314314 builder. push ( parley:: StyleProperty :: Underline ( true ) , span. range . clone ( ) ) ;
315315 builder. push (
316316 parley:: StyleProperty :: Brush ( Brush {
317- selection_fill_color : None ,
318- stroke : options. stroke ,
319- link_color : Some ( options. link_color ) ,
317+ override_fill_color : None ,
318+ stroke : self . stroke ,
319+ link_color : link_color. clone ( ) ,
320+ } ) ,
321+ span. range ,
322+ ) ;
323+ }
324+ Style :: Color ( color) => {
325+ builder. push (
326+ parley:: StyleProperty :: Brush ( Brush {
327+ override_fill_color : Some ( color) ,
328+ stroke : self . stroke ,
329+ link_color : None ,
320330 } ) ,
321331 span. range ,
322332 ) ;
323333 }
324- Style :: Color ( _) => { }
325334 }
326335 }
327336
@@ -492,7 +501,7 @@ impl TextParagraph {
492501 } ;
493502
494503 let ( fill_brush, stroke_style) =
495- match ( brush. selection_fill_color , brush. link_color ) {
504+ match ( brush. override_fill_color , brush. link_color ) {
496505 ( Some ( color) , _) => {
497506 let Some ( selection_brush) =
498507 item_renderer. platform_brush_for_color ( & color)
@@ -1176,12 +1185,12 @@ new *line*
11761185 ) ;
11771186
11781187 assert_eq ! (
1179- parse_markdown( r#"<font color="red ">hello world</font>"# ) . paragraphs,
1188+ parse_markdown( r#"<font color="blue ">hello world</font>"# ) . paragraphs,
11801189 [ RichTextParagraph {
11811190 text: "hello world" . into( ) ,
11821191 formatting: std:: vec![ FormattedSpan {
11831192 range: 0 ..11 ,
1184- style: Style :: Color ( Color :: from_rgb_u8( 255 , 0 , 0 ) )
1193+ style: Style :: Color ( Color :: from_rgb_u8( 0 , 0 , 255 ) )
11851194 } , ] ,
11861195 links: std:: vec![ ]
11871196 } ]
0 commit comments