Skip to content

Commit 958371b

Browse files
committed
chore(sass): migrate from deprecated SASS api
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
1 parent 1fba655 commit 958371b

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

core/css/inputs.scss

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: AGPL-3.0-or-later
55
*/
66
@use 'variables';
7+
@use 'sass:color';
78
@import 'functions';
89

910
/* Specifically override browser styles */
@@ -512,24 +513,24 @@ input {
512513
&.checkbox--white {
513514
+ label:before,
514515
&:focus + label:before {
515-
border-color: darken($color-checkbox-radio-white, 27%);
516+
border-color: color.adjust($color-checkbox-radio-white, $lightness: -27%, $space: hsl);
516517
}
517518
&:not(:disabled):not(:checked) + label:hover:before {
518519
border-color: $color-checkbox-radio-white;
519520
}
520521
&:checked + label:before {
521522
box-shadow: inset 0px 0px 0px 2px var(--color-main-background);
522-
background-color: darken($color-checkbox-radio-white, 14%);
523-
border-color: darken($color-checkbox-radio-white, 14%);
523+
background-color: color.adjust($color-checkbox-radio-white, $lightness: -14%, $space: hsl);
524+
border-color: color.adjust($color-checkbox-radio-white, $lightness: -14%, $space: hsl);
524525
}
525526
&:disabled + label:before {
526-
background-color: darken($color-checkbox-radio-white, 27%) !important; /* override other status */
527+
background-color: color.adjust($color-checkbox-radio-white, $lightness: -27%, $space: hsl) !important; /* override other status */
527528
border-color: rgba($color-checkbox-radio-white, 0.4) !important; /* override other status */
528529
}
529530
&:checked:disabled + label:before {
530531
box-shadow: inset 0px 0px 0px 2px var(--color-main-background);
531532
border-color: rgba($color-checkbox-radio-white, 0.4) !important; /* override other status */
532-
background-color: darken($color-checkbox-radio-white, 27%);
533+
background-color: color.adjust($color-checkbox-radio-white, $lightness: -27%, $space: hsl);
533534
}
534535
}
535536
&.checkbox--white {

core/css/variables.scss

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
@use 'sass:color';
2+
13
/*!
24
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
35
* SPDX-License-Identifier: AGPL-3.0-or-later
46
*/
57
// SCSS darken/lighten function override
68
@function nc-darken($color, $value) {
7-
@return darken($color, $value);
9+
@return color.adjust($color, $lightness: -$value, $space: hsl);
810
}
911

1012
@function nc-lighten($color, $value) {
11-
@return lighten($color, $value);
13+
@return color.adjust($color, $lightness: $value, $space: hsl);
1214
}
1315

1416
// SCSS variables
@@ -35,10 +37,10 @@ $color-primary-light-hover: mix($color-primary-light, $color-main-text, 95%) !de
3537
$color-primary-text: #ffffff !default;
3638
// do not use nc-darken/lighten in case of overriding because
3739
// primary-text is independent of color-main-text
38-
$color-primary-element-text-dark: darken($color-primary-text, 7%) !default;
40+
$color-primary-element-text-dark: color.adjust($color-primary-text, $lightness: -7%, $space: hsl) !default;
3941
$color-primary-element: $color-primary !default;
4042
$color-primary-element-hover: mix($color-primary-element, $color-main-background, 80%) !default;
41-
$color-primary-element-light: lighten($color-primary-element, 15%) !default;
43+
$color-primary-element-light: color.adjust($color-primary-element, $lightness: 15%, $space: hsl) !default;
4244

4345
$color-error: #e9322d;
4446
$color-error-hover: mix($color-error, $color-main-background, 80%) !default;
@@ -66,7 +68,7 @@ $image-favicon: url('../img/logo/logo.svg?v=1') !default;
6668
$color-loading-light: #ccc !default;
6769
$color-loading-dark: #444 !default;
6870

69-
$color-box-shadow: transparentize(nc-darken($color-main-background, 70%), 0.5) !default;
71+
$color-box-shadow: color.adjust(nc-darken($color-main-background, 70%), $alpha: -0.5, $space: hsl) !default;
7072

7173
// light border like file table or app-content list
7274
$color-border: nc-darken($color-main-background, 7%) !default;

0 commit comments

Comments
 (0)