@@ -7,7 +7,7 @@ use re_types::{
7
7
archetypes:: Pinhole , blueprint:: components:: VisualBounds2D , components:: ViewCoordinates ,
8
8
image:: ImageKind ,
9
9
} ;
10
- use re_ui:: { ContextExt as _ , UiExt as _} ;
10
+ use re_ui:: UiExt as _;
11
11
use re_viewer_context:: {
12
12
HoverHighlight , SelectionHighlight , SpaceViewHighlights , SpaceViewState , ViewerContext ,
13
13
} ;
@@ -214,11 +214,12 @@ pub fn create_labels(
214
214
} ;
215
215
216
216
let font_id = egui:: TextStyle :: Body . resolve ( parent_ui. style ( ) ) ;
217
- let format = match label. style {
218
- UiLabelStyle :: Color ( color) => egui:: TextFormat :: simple ( font_id, color) ,
219
- UiLabelStyle :: Error => parent_ui. ctx ( ) . error_text_format ( ) ,
217
+ let is_error = matches ! ( label. style, UiLabelStyle :: Error ) ;
218
+ let text_color = match label. style {
219
+ UiLabelStyle :: Color ( color) => color,
220
+ UiLabelStyle :: Error => parent_ui. style ( ) . visuals . strong_text_color ( ) ,
220
221
} ;
221
- let text_color = format . color ;
222
+ let format = egui :: TextFormat :: simple ( font_id , text_color ) ;
222
223
223
224
let galley = parent_ui. fonts ( |fonts| {
224
225
fonts. layout_job ( {
@@ -249,7 +250,13 @@ pub fn create_labels(
249
250
. index_highlight ( label. labeled_instance . instance ) ;
250
251
let background_color = match highlight. hover {
251
252
HoverHighlight :: None => match highlight. selection {
252
- SelectionHighlight :: None => parent_ui. style ( ) . visuals . panel_fill ,
253
+ SelectionHighlight :: None => {
254
+ if is_error {
255
+ parent_ui. error_label_background_color ( )
256
+ } else {
257
+ parent_ui. style ( ) . visuals . panel_fill
258
+ }
259
+ }
253
260
SelectionHighlight :: SiblingSelection => {
254
261
parent_ui. style ( ) . visuals . widgets . active . bg_fill
255
262
}
@@ -258,7 +265,16 @@ pub fn create_labels(
258
265
HoverHighlight :: Hovered => parent_ui. style ( ) . visuals . widgets . hovered . bg_fill ,
259
266
} ;
260
267
261
- label_shapes. push ( egui:: Shape :: rect_filled ( bg_rect, 3.0 , background_color) ) ;
268
+ let rect_stroke = if is_error {
269
+ egui:: Stroke :: new ( 1.0 , parent_ui. style ( ) . visuals . error_fg_color )
270
+ } else {
271
+ egui:: Stroke :: NONE
272
+ } ;
273
+
274
+ label_shapes. push (
275
+ egui:: epaint:: RectShape :: new ( bg_rect. expand ( 4.0 ) , 4.0 , background_color, rect_stroke)
276
+ . into ( ) ,
277
+ ) ;
262
278
label_shapes. push ( egui:: Shape :: galley (
263
279
text_rect. center_top ( ) ,
264
280
galley,
0 commit comments