18
18
19
19
#include < rviz_common/display_context.hpp>
20
20
21
+ #include < qcolor.h>
22
+
21
23
#include < memory>
22
24
#include < string>
23
25
@@ -41,7 +43,10 @@ AutowareStatePanel::AutowareStatePanel(QWidget * parent) : rviz_common::Panel(pa
41
43
QWidget * containerWidget = new QWidget (this );
42
44
containerWidget->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
43
45
44
- containerWidget->setStyleSheet (" QWidget { background-color: #0F1417; color: #d0e6f2; }" );
46
+ containerWidget->setStyleSheet (
47
+ QString (" QWidget { background-color: %1; color: %2; }" )
48
+ .arg (autoware::state_rviz_plugin::colors::default_colors.background .c_str ())
49
+ .arg (autoware::state_rviz_plugin::colors::default_colors.on_surface .c_str ()));
45
50
46
51
auto * containerLayout = new QVBoxLayout (containerWidget);
47
52
// Set the alignment of the layout
@@ -188,7 +193,9 @@ QVBoxLayout * AutowareStatePanel::makeOperationModeGroup()
188
193
&AutowareStatePanel::onSwitchStateChanged);
189
194
190
195
control_mode_label_ptr_ = new QLabel (" Autoware Control" );
191
- control_mode_label_ptr_->setStyleSheet (" color: #d0e6f2; font-weight: bold;" );
196
+ control_mode_label_ptr_->setStyleSheet (
197
+ QString (" color: %1; font-weight: bold;" )
198
+ .arg (autoware::state_rviz_plugin::colors::default_colors.on_secondary_container .c_str ()));
192
199
193
200
CustomContainer * group1 = new CustomContainer (this );
194
201
@@ -226,15 +233,18 @@ QVBoxLayout * AutowareStatePanel::makeRoutingGroup()
226
233
227
234
auto * custom_container = new CustomContainer (this );
228
235
229
- routing_icon = new CustomIconLabel (QColor (" #84c2e6" ));
236
+ routing_icon = new CustomIconLabel (
237
+ QColor (autoware::state_rviz_plugin::colors::default_colors.primary .c_str ()));
230
238
231
239
clear_route_button_ptr_ = new CustomElevatedButton (" Clear Route" );
232
240
clear_route_button_ptr_->setCheckable (true );
233
241
clear_route_button_ptr_->setCursor (Qt::PointingHandCursor);
234
242
connect (clear_route_button_ptr_, SIGNAL (clicked ()), SLOT (onClickClearRoute ()));
235
243
236
244
QLabel * routing_label = new QLabel (" Routing" );
237
- routing_label->setStyleSheet (" color: #d0e6f2; font-weight: bold;" );
245
+ routing_label->setStyleSheet (
246
+ QString (" color: %1; font-weight: bold;" )
247
+ .arg (autoware::state_rviz_plugin::colors::default_colors.on_secondary_container .c_str ()));
238
248
239
249
auto * horizontal_layout = new QHBoxLayout;
240
250
horizontal_layout->setSpacing (10 );
@@ -262,9 +272,12 @@ QVBoxLayout * AutowareStatePanel::makeLocalizationGroup()
262
272
init_by_gnss_button_ptr_->setCursor (Qt::PointingHandCursor);
263
273
connect (init_by_gnss_button_ptr_, SIGNAL (clicked ()), SLOT (onClickInitByGnss ()));
264
274
265
- localization_icon = new CustomIconLabel (QColor (" #84c2e6" ));
275
+ localization_icon = new CustomIconLabel (
276
+ QColor (autoware::state_rviz_plugin::colors::default_colors.primary .c_str ()));
266
277
QLabel * localization_label = new QLabel (" Localization" );
267
- localization_label->setStyleSheet (" color: #d0e6f2; font-weight: bold;" );
278
+ localization_label->setStyleSheet (
279
+ QString (" color: %1; font-weight: bold;" )
280
+ .arg (autoware::state_rviz_plugin::colors::default_colors.on_secondary_container .c_str ()));
268
281
269
282
auto * horizontal_layout = new QHBoxLayout;
270
283
horizontal_layout->setSpacing (10 );
@@ -292,9 +305,12 @@ QVBoxLayout * AutowareStatePanel::makeMotionGroup()
292
305
accept_start_button_ptr_->setCursor (Qt::PointingHandCursor);
293
306
connect (accept_start_button_ptr_, SIGNAL (clicked ()), SLOT (onClickAcceptStart ()));
294
307
295
- motion_icon = new CustomIconLabel (QColor (" #84c2e6" ));
308
+ motion_icon = new CustomIconLabel (
309
+ QColor (autoware::state_rviz_plugin::colors::default_colors.primary .c_str ()));
296
310
QLabel * motion_label = new QLabel (" Motion" );
297
- motion_label->setStyleSheet (" color: #d0e6f2; font-weight: bold;" );
311
+ motion_label->setStyleSheet (
312
+ QString (" color: %1; font-weight: bold;" )
313
+ .arg (autoware::state_rviz_plugin::colors::default_colors.on_secondary_container .c_str ()));
298
314
299
315
auto * horizontal_layout = new QHBoxLayout;
300
316
horizontal_layout->setSpacing (10 );
@@ -321,15 +337,21 @@ QVBoxLayout * AutowareStatePanel::makeFailSafeGroup()
321
337
auto * custom_container1 = new CustomContainer (this );
322
338
auto * custom_container2 = new CustomContainer (this );
323
339
324
- mrm_state_icon = new CustomIconLabel (QColor (" #84c2e6" ));
325
- mrm_behavior_icon = new CustomIconLabel (QColor (" #84c2e6" ));
340
+ mrm_state_icon = new CustomIconLabel (
341
+ QColor (autoware::state_rviz_plugin::colors::default_colors.primary .c_str ()));
342
+ mrm_behavior_icon = new CustomIconLabel (
343
+ QColor (autoware::state_rviz_plugin::colors::default_colors.primary .c_str ()));
326
344
327
345
mrm_state_label_ptr_ = new QLabel (" MRM State | Unknown" );
328
346
mrm_behavior_label_ptr_ = new QLabel (" MRM Behavior | Unknown" );
329
347
330
348
// change text color
331
- mrm_state_label_ptr_->setStyleSheet (" color: #d0e6f2; font-weight: bold;" );
332
- mrm_behavior_label_ptr_->setStyleSheet (" color: #d0e6f2; font-weight: bold;" );
349
+ mrm_state_label_ptr_->setStyleSheet (
350
+ QString (" color: %1; font-weight: bold;" )
351
+ .arg (autoware::state_rviz_plugin::colors::default_colors.on_secondary_container .c_str ()));
352
+ mrm_behavior_label_ptr_->setStyleSheet (
353
+ QString (" color: %1; font-weight: bold;" )
354
+ .arg (autoware::state_rviz_plugin::colors::default_colors.on_secondary_container .c_str ()));
333
355
334
356
auto * horizontal_layout = new QHBoxLayout;
335
357
horizontal_layout->setSpacing (10 );
@@ -514,7 +536,8 @@ void AutowareStatePanel::onOperationMode(const OperationModeState::ConstSharedPt
514
536
515
537
// routing
516
538
if (msg->is_in_transition ) {
517
- routing_icon->updateStyle (Pending, QColor (" #eef08b" ));
539
+ routing_icon->updateStyle (
540
+ Pending, QColor (autoware::state_rviz_plugin::colors::default_colors.warning .c_str ()));
518
541
}
519
542
}
520
543
@@ -526,27 +549,27 @@ void AutowareStatePanel::onRoute(const RouteState::ConstSharedPtr msg)
526
549
switch (msg->state ) {
527
550
case RouteState::UNSET:
528
551
state = Pending;
529
- bgColor = QColor (" #eef08b " );
552
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. warning . c_str () );
530
553
break ;
531
554
532
555
case RouteState::SET:
533
556
state = Active;
534
- bgColor = QColor (" #00e678 " );
557
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. success . c_str () );
535
558
break ;
536
559
537
560
case RouteState::ARRIVED:
538
561
state = Danger;
539
- bgColor = QColor (" #f08b8b " );
562
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. danger . c_str () );
540
563
break ;
541
564
542
565
case RouteState::CHANGING:
543
- bgColor = QColor (" #eef08b " );
566
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. warning . c_str () );
544
567
state = Pending;
545
568
break ;
546
569
547
570
default :
548
571
state = None;
549
- bgColor = QColor (" #84c2e6 " );
572
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. info . c_str () );
550
573
break ;
551
574
}
552
575
@@ -556,11 +579,15 @@ void AutowareStatePanel::onRoute(const RouteState::ConstSharedPtr msg)
556
579
activateButton (clear_route_button_ptr_);
557
580
} else {
558
581
clear_route_button_ptr_->setStyleSheet (
559
- " QPushButton {"
560
- " background-color: #292d30;color: #6e7276;"
561
- " border: 2px solid #292d30;"
562
- " font-weight: bold;"
563
- " }" );
582
+ QString (" QPushButton {"
583
+ " background-color: %1;color: %2;"
584
+ " border: 2px solid %3;"
585
+ " font-weight: bold;"
586
+ " }" )
587
+ .arg (autoware::state_rviz_plugin::colors::default_colors.surface_container_highest .c_str ())
588
+ .arg (autoware::state_rviz_plugin::colors::default_colors.outline .c_str ())
589
+ .arg (
590
+ autoware::state_rviz_plugin::colors::default_colors.surface_container_highest .c_str ()));
564
591
deactivateButton (clear_route_button_ptr_);
565
592
}
566
593
}
@@ -573,22 +600,22 @@ void AutowareStatePanel::onLocalization(const LocalizationInitializationState::C
573
600
switch (msg->state ) {
574
601
case LocalizationInitializationState::UNINITIALIZED:
575
602
state = None;
576
- bgColor = QColor (" #84c2e6 " );
603
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. info . c_str () );
577
604
break ;
578
605
579
606
case LocalizationInitializationState::INITIALIZED:
580
607
state = Active;
581
- bgColor = QColor (" #00e678 " );
608
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. success . c_str () );
582
609
break ;
583
610
584
611
case LocalizationInitializationState::INITIALIZING:
585
612
state = Pending;
586
- bgColor = QColor (" #eef08b " );
613
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. warning . c_str () );
587
614
break ;
588
615
589
616
default :
590
617
state = None;
591
- bgColor = QColor (" #84c2e6 " );
618
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. info . c_str () );
592
619
break ;
593
620
}
594
621
@@ -603,22 +630,22 @@ void AutowareStatePanel::onMotion(const MotionState::ConstSharedPtr msg)
603
630
switch (msg->state ) {
604
631
case MotionState::STARTING:
605
632
state = Pending;
606
- bgColor = QColor (" #eef08b " );
633
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. warning . c_str () );
607
634
break ;
608
635
609
636
case MotionState::MOVING:
610
637
state = Active;
611
- bgColor = QColor (" #00e678 " );
638
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. success . c_str () );
612
639
break ;
613
640
614
641
case MotionState::STOPPED:
615
642
state = None;
616
- bgColor = QColor (" #f08b8b " );
643
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. danger . c_str () );
617
644
break ;
618
645
619
646
default :
620
647
state = Danger;
621
- bgColor = QColor (" #84c2e6 " );
648
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. info . c_str () );
622
649
break ;
623
650
}
624
651
@@ -640,31 +667,31 @@ void AutowareStatePanel::onMRMState(const MRMState::ConstSharedPtr msg)
640
667
switch (msg->state ) {
641
668
case MRMState::NONE:
642
669
state = None;
643
- bgColor = QColor (" #84c2e6 " );
670
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. info . c_str () );
644
671
mrm_state = " MRM State | Inactive" ;
645
672
break ;
646
673
647
674
case MRMState::MRM_OPERATING:
648
675
state = Active;
649
- bgColor = QColor (" #84c2e6 " );
676
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. info . c_str () );
650
677
mrm_state = " MRM State | Operating" ;
651
678
break ;
652
679
653
680
case MRMState::MRM_SUCCEEDED:
654
681
state = Active;
655
- bgColor = QColor (" #00e678 " );
682
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. success . c_str () );
656
683
mrm_state = " MRM State | Successful" ;
657
684
break ;
658
685
659
686
case MRMState::MRM_FAILED:
660
687
state = Danger;
661
- bgColor = QColor (" #f08b8b " );
688
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. danger . c_str () );
662
689
mrm_state = " MRM State | Failed" ;
663
690
break ;
664
691
665
692
default :
666
693
state = None;
667
- bgColor = QColor (" #84c2e6 " );
694
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. info . c_str () );
668
695
mrm_state = " MRM State | Unknown" ;
669
696
break ;
670
697
}
@@ -681,31 +708,31 @@ void AutowareStatePanel::onMRMState(const MRMState::ConstSharedPtr msg)
681
708
switch (msg->behavior ) {
682
709
case MRMState::NONE:
683
710
state = Crash;
684
- bgColor = QColor (" #84c2e6 " );
711
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. info . c_str () );
685
712
mrm_behavior = " MRM Behavior | Inactive" ;
686
713
break ;
687
714
688
715
case MRMState::PULL_OVER:
689
716
state = Crash;
690
- bgColor = QColor (" #00e678 " );
717
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. success . c_str () );
691
718
mrm_behavior = " MRM Behavior | Pull Over" ;
692
719
break ;
693
720
694
721
case MRMState::COMFORTABLE_STOP:
695
722
state = Crash;
696
- bgColor = QColor (" #eef08b " );
723
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. warning . c_str () );
697
724
mrm_behavior = " MRM Behavior | Comfortable Stop" ;
698
725
break ;
699
726
700
727
case MRMState::EMERGENCY_STOP:
701
728
state = Crash;
702
- bgColor = QColor (" #f08b8b " );
729
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. danger . c_str () );
703
730
mrm_behavior = " MRM Behavior | Emergency Stop" ;
704
731
break ;
705
732
706
733
default :
707
734
state = Crash;
708
- bgColor = QColor (" #84c2e6 " );
735
+ bgColor = QColor (autoware::state_rviz_plugin::colors::default_colors. info . c_str () );
709
736
mrm_behavior = " MRM Behavior | Unknown" ;
710
737
break ;
711
738
}
@@ -837,10 +864,19 @@ void AutowareStatePanel::onEmergencyStatus(
837
864
current_emergency_ = msg->emergency ;
838
865
if (msg->emergency ) {
839
866
emergency_button_ptr_->updateStyle (
840
- " Clear Emergency" , QColor (" #f08b8b" ), QColor (" #FFDAD6" ), QColor (" #ed7474" ));
867
+ " Clear Emergency" ,
868
+ QColor (autoware::state_rviz_plugin::colors::default_colors.error_container .c_str ()),
869
+ QColor (autoware::state_rviz_plugin::colors::default_colors.on_error_container .c_str ()),
870
+ QColor (autoware::state_rviz_plugin::colors::default_colors.on_error .c_str ()),
871
+ QColor (autoware::state_rviz_plugin::colors::default_colors.on_error_container .c_str ()),
872
+ QColor (autoware::state_rviz_plugin::colors::default_colors.error_container .c_str ()));
841
873
} else {
842
874
emergency_button_ptr_->updateStyle (
843
- " Set Emergency" , QColor (" #84c2e6" ), QColor (" #003546" ), QColor (" #8bd0f0" ));
875
+ " Set Emergency" , QColor (autoware::state_rviz_plugin::colors::default_colors.primary .c_str ()),
876
+ QColor (autoware::state_rviz_plugin::colors::default_colors.on_primary .c_str ()),
877
+ QColor (autoware::state_rviz_plugin::colors::default_colors.on_primary_container .c_str ()),
878
+ QColor (autoware::state_rviz_plugin::colors::default_colors.on_primary .c_str ()),
879
+ QColor (autoware::state_rviz_plugin::colors::default_colors.surface_tint .c_str ()));
844
880
}
845
881
}
846
882
0 commit comments