Skip to content

Commit 9a7aa31

Browse files
Merge pull request #4791 from nextcloud-libraries/bugfix/4785/tab-headers-and-checkboxes-contrast
fix(NcCheckboxRadioSwitch): Fix contrast of Radio switches using butt…
2 parents 83e17ff + f261b94 commit 9a7aa31

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

src/components/NcCheckboxRadioSwitch/NcCheckboxContent.vue

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@
2323
<template>
2424
<component :is="wrapperElement"
2525
:for="!isButtonType ? id : null"
26-
class="checkbox-content">
27-
<span :class="['checkbox-content__icon', iconClass]"
26+
class="checkbox-content"
27+
:class="{
28+
['checkbox-content-' + type]: true,
29+
'checkbox-content--button-variant': buttonVariant,
30+
}">
31+
<span :class="{
32+
'checkbox-content__icon': true,
33+
'checkbox-content__icon--checked': isChecked,
34+
[iconClass]: true
35+
}"
2836
:aria-hidden="true">
2937
<!-- @slot The checkbox/radio icon, you can use it for adding an icon to the button variant
3038
@binding {bool} checked The input checked state
@@ -222,11 +230,26 @@ export default {
222230
}
223231
224232
&__icon > * {
225-
color: var(--color-primary-element);
226233
width: var(--icon-size);
227234
height: var(--icon-size);
228235
}
229236
237+
&--button-variant {
238+
.checkbox-content__icon:not(.checkbox-content__icon--checked) > * {
239+
color: var(--color-primary-element);
240+
}
241+
242+
.checkbox-content__icon--checked > * {
243+
color: var(--color-primary-element-text);
244+
}
245+
}
246+
247+
&:not(&--button-variant) {
248+
.checkbox-content__icon > * {
249+
color: var(--color-primary-element);
250+
}
251+
}
252+
230253
&, * {
231254
cursor: pointer;
232255
}

src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,11 @@ export default {
641641
642642
&--checked:not(&--disabled):focus-within &__content,
643643
&--checked:not(&--disabled) &__content:hover {
644+
background-color: var(--color-primary-element-hover);
645+
}
646+
647+
&--checked:not(&--button-variant):not(&--disabled):focus-within &__content,
648+
&--checked:not(&--button-variant):not(&--disabled) &__content:hover {
644649
background-color: var(--color-primary-element-light-hover);
645650
}
646651
@@ -666,7 +671,8 @@ export default {
666671
font-weight: bold;
667672
668673
.checkbox-radio-switch__content {
669-
background-color: var(--color-primary-element-light);
674+
background-color: var(--color-primary-element);
675+
color: var(--color-primary-element-text);
670676
}
671677
}
672678
}

0 commit comments

Comments
 (0)