@@ -556,21 +556,18 @@ pub fn primary(theme: &Theme, status: Status) -> Style {
556556
557557 match status {
558558 Status :: Active { is_checked } => styled (
559- palette. primary . strong . text ,
560559 palette. background . strongest . color ,
561560 palette. background . base ,
562561 palette. primary . base ,
563562 is_checked,
564563 ) ,
565564 Status :: Hovered { is_checked } => styled (
566- palette. primary . strong . text ,
567565 palette. background . strongest . color ,
568566 palette. background . weak ,
569567 palette. primary . strong ,
570568 is_checked,
571569 ) ,
572570 Status :: Disabled { is_checked } => styled (
573- palette. primary . strong . text ,
574571 palette. background . weak . color ,
575572 palette. background . weak ,
576573 palette. background . strong ,
@@ -585,21 +582,18 @@ pub fn secondary(theme: &Theme, status: Status) -> Style {
585582
586583 match status {
587584 Status :: Active { is_checked } => styled (
588- palette. background . base . text ,
589585 palette. background . strongest . color ,
590586 palette. background . base ,
591587 palette. background . strong ,
592588 is_checked,
593589 ) ,
594590 Status :: Hovered { is_checked } => styled (
595- palette. background . base . text ,
596591 palette. background . strongest . color ,
597592 palette. background . weak ,
598593 palette. background . strong ,
599594 is_checked,
600595 ) ,
601596 Status :: Disabled { is_checked } => styled (
602- palette. background . strong . color ,
603597 palette. background . weak . color ,
604598 palette. background . weak ,
605599 palette. background . weak ,
@@ -614,21 +608,18 @@ pub fn success(theme: &Theme, status: Status) -> Style {
614608
615609 match status {
616610 Status :: Active { is_checked } => styled (
617- palette. success . base . text ,
618611 palette. background . weak . color ,
619612 palette. background . base ,
620613 palette. success . base ,
621614 is_checked,
622615 ) ,
623616 Status :: Hovered { is_checked } => styled (
624- palette. success . base . text ,
625617 palette. background . strongest . color ,
626618 palette. background . weak ,
627619 palette. success . strong ,
628620 is_checked,
629621 ) ,
630622 Status :: Disabled { is_checked } => styled (
631- palette. success . base . text ,
632623 palette. background . weak . color ,
633624 palette. background . weak ,
634625 palette. success . weak ,
@@ -643,21 +634,18 @@ pub fn danger(theme: &Theme, status: Status) -> Style {
643634
644635 match status {
645636 Status :: Active { is_checked } => styled (
646- palette. danger . base . text ,
647637 palette. background . strongest . color ,
648638 palette. background . base ,
649639 palette. danger . base ,
650640 is_checked,
651641 ) ,
652642 Status :: Hovered { is_checked } => styled (
653- palette. danger . base . text ,
654643 palette. background . strongest . color ,
655644 palette. background . weak ,
656645 palette. danger . strong ,
657646 is_checked,
658647 ) ,
659648 Status :: Disabled { is_checked } => styled (
660- palette. danger . base . text ,
661649 palette. background . weak . color ,
662650 palette. background . weak ,
663651 palette. danger . weak ,
@@ -667,27 +655,24 @@ pub fn danger(theme: &Theme, status: Status) -> Style {
667655}
668656
669657fn styled (
670- icon_color : Color ,
671658 border_color : Color ,
672659 base : palette:: Pair ,
673660 accent : palette:: Pair ,
674661 is_checked : bool ,
675662) -> Style {
663+ let ( background, border) = if is_checked {
664+ ( accent, accent. color )
665+ } else {
666+ ( base, border_color)
667+ } ;
668+
676669 Style {
677- background : Background :: Color ( if is_checked {
678- accent. color
679- } else {
680- base. color
681- } ) ,
682- icon_color,
670+ background : Background :: Color ( background. color ) ,
671+ icon_color : background. text ,
683672 border : Border {
684673 radius : 2.0 . into ( ) ,
685674 width : 1.0 ,
686- color : if is_checked {
687- accent. color
688- } else {
689- border_color
690- } ,
675+ color : border,
691676 } ,
692677 text_color : None ,
693678 }
0 commit comments