Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions src/definitions/modules/checkbox.less
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,62 @@
}
}

& when (@variationCheckboxColored) {
/*--------------
Colored
---------------*/

each(@colors, {
@color: replace(@key, '@', '');
@c: @colors[@@color][color];
@l: @colors[@@color][light];
@isVeryDark: @colors[@@color][isVeryDark];

.ui.@{color}.checkbox input:checked ~ label::after {
color: @color;
}
.ui.@{color}.radio.checkbox input:checked ~ label::after {
background-color: @color;
}
.ui.@{color}.toggle.checkbox input:checked ~ label::before,
.ui.@{color}.slider.checkbox input:checked ~ label::before {
background-color: @color !important;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beside the variable name: Any chance to increase specificity without using !important? (Haven't tested myself yet!)

Suggested change
.ui.@{color}.toggle.checkbox input:checked ~ label::before,
.ui.@{color}.slider.checkbox input:checked ~ label::before {
background-color: @color !important;
}
.ui.ui.@{color}.toggle.checkbox input:checked ~ label::before,
.ui.ui.@{color}.slider.checkbox input:checked ~ label::before {
background-color: @c;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried .ui.ui and .ui.ui.ui, but still need that !important to work... 😞

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because there is an existing !important at

.ui.toggle.checkbox input:checked ~ label:before {
    background-color: #2185D0 !important;
}

We would need to remove the !important from there too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check the checkbox.less there are still a few !important for toggle and slider which are causing this. This PR is a good chance to get rid of them as well 😉


& when (@variationCheckboxOutline) {
/*--------------
Outline
---------------*/
.ui.@{color}.outline.checkbox input:checked ~ label::before {
border-color: @color;
}
.ui.@{color}.outline.toggle.checkbox input:checked ~ label::after,
.ui.@{color}.outline.slider.checkbox input:checked ~ label::after {
box-shadow: @subtleShadow,
0 0 0 1px @color inset;
}
}
})
}

/*--------------------
outline
---------------------*/

& when (@variationCheckboxOutline) {
.ui.outline.checkbox input:checked ~ label::before {
border-color: @checkboxActiveCheckColor;
}
.ui.outline.toggle.checkbox input:checked ~ label::after {
box-shadow: @subtleShadow,
0 0 0 1px @toggleOnLaneColor inset;
}
.ui.outline.slider.checkbox input:checked ~ label::after {
box-shadow: @subtleShadow,
0 0 0 1px @checkboxActiveCheckColor inset;
}
}

/*--------------------
Size
---------------------*/
Expand Down
2 changes: 2 additions & 0 deletions src/themes/default/globals/variation.variables
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@
@variationCheckboxFitted: true;
@variationCheckboxRightAligned: true;
@variationCheckboxSizes: @variationAllSizes;
@variationCheckboxColored: true;
@variationCheckboxOutline: true;

/* Dimmer */
@variationDimmerInverted: true;
Expand Down