Skip to content

Commit 5828c5b

Browse files
authored
fix: circle control contrast (#1835)
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
1 parent 65dd5a1 commit 5828c5b

1 file changed

Lines changed: 57 additions & 21 deletions

File tree

src/components/widgets/toolhead/ToolheadControlCircle.vue

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
class="app-circle-control"
1414
:class="{
1515
[$vuetify.theme.dark ? 'theme--dark': 'theme--light']: true,
16+
'theme--text--contrast': !isPrimaryColorDark
1617
}"
1718
>
1819
<g class="cc-section">
@@ -543,6 +544,10 @@ export default class ToolheadControlCircle extends Mixins(StateMixin, ToolheadMi
543544
return this.$typedGetters['printer/getHasSteppersEnabled']
544545
}
545546
547+
get isPrimaryColorDark (): boolean {
548+
return this.$filters.isColorDark(this.$typedState.config.uiSettings.theme.color)
549+
}
550+
546551
get klippyApp (): KlippyApp {
547552
return this.$typedGetters['printer/getKlippyApp']
548553
}
@@ -784,48 +789,59 @@ export default class ToolheadControlCircle extends Mixins(StateMixin, ToolheadMi
784789
@import 'vuetify/src/styles/styles.sass';
785790
786791
@include theme(app-circle-control) using ($material) {
792+
$material-text-primary: map-deep-get($material, 'text', 'primary');
793+
$material-buttons-disabled: map-deep-get($material, 'buttons', 'disabled');
794+
787795
.disabled {
788-
fill: map-deep-get($material, 'buttons', 'disabled') !important;
789-
stroke: map-deep-get($material, 'buttons', 'disabled') !important;
796+
fill: $material-buttons-disabled !important;
797+
stroke: $material-buttons-disabled !important;
790798
}
791799
792800
.cc-btn,
793801
.cc-lbl {
794-
fill: map-deep-get($material, 'text', 'primary');
795-
stroke: map-deep-get($material, 'text', 'primary');
802+
fill: $material-text-primary;
803+
stroke: $material-text-primary;
796804
}
797805
}
798806
799-
@mixin cc-btn-theme ($component, $text, $back, $hover) {
807+
@mixin cc-btn-theme ($component, $text: null, $back: null, $hover: null) {
800808
&#{$component} {
801-
fill: #{$text};
802-
stroke: #{$text};
809+
@if $text {
810+
fill: $text;
811+
stroke: $text;
812+
}
803813
804-
.cc-btn-container {
805-
fill: #{$back};
814+
@if $back {
815+
.cc-btn-container {
816+
fill: #{$back};
817+
}
806818
}
807819
808-
&:hover .cc-btn-container {
809-
fill: #{$hover};
820+
@if $hover {
821+
&:hover .cc-btn-container {
822+
fill: #{$hover};
823+
}
810824
}
811825
}
812826
}
813827
814828
.theme--light.app-circle-control .cc-btn {
815-
@include cc-btn-theme('.inner', '', 'var(--v-btncolor-lighten1)', '');
816-
@include cc-btn-theme('.inner-mid', '', 'var(--v-btncolor-base)', '');
817-
@include cc-btn-theme('.outer-mid', '', 'var(--v-btncolor-darken1)', '');
818-
@include cc-btn-theme('.outer', '', 'var(--v-btncolor-darken2)', '');
829+
@include cc-btn-theme('.inner', $back: 'var(--v-btncolor-lighten1)');
830+
@include cc-btn-theme('.inner-mid', $back: 'var(--v-btncolor-base)');
831+
@include cc-btn-theme('.outer-mid', $back: 'var(--v-btncolor-darken1)');
832+
@include cc-btn-theme('.outer', $back: 'var(--v-btncolor-darken2)');
819833
}
820834
821835
.theme--dark.app-circle-control .cc-btn {
822-
@include cc-btn-theme('.inner', '', 'var(--v-btncolor-lighten2)', '');
823-
@include cc-btn-theme('.inner-mid', '', 'var(--v-btncolor-lighten1)', '');
824-
@include cc-btn-theme('.outer-mid', '', 'var(--v-btncolor-base)', '');
825-
@include cc-btn-theme('.outer', '', 'var(--v-btncolor-darken1)', '');
836+
@include cc-btn-theme('.inner', $back: 'var(--v-btncolor-lighten2)');
837+
@include cc-btn-theme('.inner-mid', $back: 'var(--v-btncolor-lighten1)');
838+
@include cc-btn-theme('.outer-mid', $back: 'var(--v-btncolor-base)');
839+
@include cc-btn-theme('.outer', $back: 'var(--v-btncolor-darken1)');
826840
}
827841
828842
.app-circle-control {
843+
$material-dark-text-primary: map-deep-get($material-dark, 'text', 'primary');
844+
829845
font-size: 16px;
830846
max-height: 350px;
831847
min-height: 275px;
@@ -849,8 +865,6 @@ export default class ToolheadControlCircle extends Mixins(StateMixin, ToolheadMi
849865
}
850866
851867
&:not(.disabled) {
852-
$material-dark-text-primary: map-deep-get($material-dark, 'text', 'primary');
853-
854868
@include cc-btn-theme(
855869
'.primary',
856870
$material-dark-text-primary,
@@ -890,6 +904,10 @@ export default class ToolheadControlCircle extends Mixins(StateMixin, ToolheadMi
890904
.cc-lbl {
891905
pointer-events: none;
892906
stroke-width: 0;
907+
908+
&:not(.disabled) {
909+
fill: $material-dark-text-primary;
910+
}
893911
}
894912
895913
.large {
@@ -900,4 +918,22 @@ export default class ToolheadControlCircle extends Mixins(StateMixin, ToolheadMi
900918
pointer-events: none;
901919
}
902920
}
921+
922+
.theme--text--contrast.app-circle-control {
923+
$material-light-text-primary: map-deep-get($material-light, 'text', 'primary');
924+
925+
.cc-btn {
926+
&:not(.disabled) {
927+
@each $cls in '.primary', '.inner', '.inner-mid', '.outer-mid', '.outer' {
928+
@include cc-btn-theme($cls, $material-light-text-primary);
929+
}
930+
}
931+
}
932+
933+
.cc-lbl {
934+
&:not(.disabled) {
935+
fill: $material-light-text-primary;
936+
}
937+
}
938+
}
903939
</style>

0 commit comments

Comments
 (0)