Skip to content

Commit

Permalink
fix: replace deprecated darken/lighten scss functions (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys authored Oct 6, 2024
1 parent 9c27c66 commit c870c65
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/sass/_asciidoc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@each $name, $color in $hint-colors {
&.#{$name} {
border-left-color: $color;
background-color: scale-color($color, $lightness: 95%, $saturation: -30%);
background-color: color.scale($color, $lightness: 95%, $saturation: -30%);
color: $body-font-color;
}
}
Expand All @@ -28,7 +28,7 @@
padding: $padding-4 $padding-16 !important;

&:first-child {
background-color: scale-color($gray-600, $alpha: -95%);
background-color: color.scale($gray-600, $alpha: -95%);
font-weight: bold;

&.icon {
Expand Down
2 changes: 1 addition & 1 deletion src/sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ svg.gblog-icon {
&:hover,
&.is-active,
&:visited:hover {
background: lighten($second-color, 10%);
background: color.scale($second-color, $lightness: 10%);
}

&:visited {
Expand Down
40 changes: 18 additions & 22 deletions src/sass/_color_mode.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

--mark-color: #{$mark-color};

--button-background: #{lighten($main-color, 2)};
--button-background: #{color.scale($main-color, $lightness: 15%)};
--button-border-color: #{$main-color};

--link-color: #{$link-color};
Expand All @@ -20,7 +20,7 @@
--accent-color: #{$gray-200};
--accent-color-lite: #{$gray-100};

--control-icons: #{lighten($body-font-color, 50)};
--control-icons: #{color.scale($body-font-color, $lightness: 40%)};

--footer-background: #{$second-color};
--footer-font-color: #{$white};
Expand All @@ -45,11 +45,11 @@
--header-font-color: #{$white};

--body-background: #{$body-background-dark};
--body-font-color: #{lighten($body-background-dark, 60)};
--body-font-color: #{color.scale($body-background-dark, $lightness: 70%)};

--mark-color: #{$mark-color};

--button-background: #{lighten($main-color, 2)};
--button-background: #{color.scale($main-color, $lightness: 15%)};
--button-border-color: #{$main-color};

--link-color: #{$link-color-dark};
Expand All @@ -58,15 +58,11 @@
--hint-link-color: #{$link-color};
--hint-link-color-visited: #{$link-color-visited};

--code-copy-font-color: #{lighten($body-font-color, 48)};
--code-copy-border-color: #{lighten($body-font-color, 32)};
--code-copy-success-color: #{map.get($hint-colors, "ok")};
--accent-color-dark: #{color.scale($body-background-dark, $lightness: -60%)};
--accent-color: #{color.scale($body-background-dark, $lightness: -30%)};
--accent-color-lite: #{color.scale($body-background-dark, $lightness: -15%)};

--accent-color-dark: #{darken($body-background-dark, 8)};
--accent-color: #{darken($body-background-dark, 4)};
--accent-color-lite: #{darken($body-background-dark, 2)};

--control-icons: #{lighten($body-font-color, 50)};
--control-icons: #{color.scale($body-font-color, $lightness: 40%)};

--footer-background: #{$second-color};
--footer-font-color: #{$white};
Expand Down Expand Up @@ -106,7 +102,7 @@

.gblog-hint__title,
.admonitionblock table td:first-child {
background-color: scale-color($gray-600, $alpha: -85%);
background-color: color.scale($gray-600, $alpha: -85%);
}
}
}
Expand All @@ -116,14 +112,14 @@

& {
--code-background: #{$code-background-dark};
--code-accent-color: #{darken($code-background-dark, 4)};
--code-accent-color-lite: #{darken($code-background-dark, 2)};
--code-accent-color: #{color.scale($code-background-dark, $lightness: -30%)};
--code-accent-color-lite: #{color.scale($code-background-dark, $lightness: -15%)};
--code-font-color: #{$code-font-color-dark};

--code-copy-background: #{$code-background-dark};
--code-copy-font-color: #{darken($code-font-color-dark, 15)};
--code-copy-border-color: #{darken($code-font-color-dark, 20)};
--code-copy-success-color: #{scale-color(map.get($hint-colors, "ok"), $alpha: -55%)};
--code-copy-font-color: #{color.scale($code-font-color-dark, $lightness: -15%)};
--code-copy-border-color: #{color.scale($code-font-color-dark, $lightness: -20%)};
--code-copy-success-color: #{color.scale(map.get($hint-colors, "ok"), $alpha: -55%)};
}
}

Expand All @@ -132,13 +128,13 @@

& {
--code-background: #{$code-background};
--code-accent-color: #{darken($code-background, 6)};
--code-accent-color-lite: #{darken($code-background, 2)};
--code-accent-color: #{color.scale($code-background, $lightness: -45%)};
--code-accent-color-lite: #{color.scale($code-background, $lightness: -15%)};
--code-font-color: #{$code-font-color};

--code-copy-background: #{$code-background};
--code-copy-font-color: #{lighten($code-font-color, 15)};
--code-copy-border-color: #{lighten($code-font-color, 20)};
--code-copy-font-color: #{color.scale($code-font-color, $lightness: 20%)};
--code-copy-border-color: #{color.scale($code-font-color, $lightness: 40%)};
--code-copy-success-color: #{map.get($hint-colors, "ok")};
}
}
6 changes: 4 additions & 2 deletions src/sass/_defaults.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "sass:color";

// Used in layout
$padding-2: 0.125rem !default;
$padding-4: 0.25rem !default;
Expand Down Expand Up @@ -66,8 +68,8 @@ $body-font-color-dark: $gray-100 !default;
$link-color-dark: rgba(110, 168, 212, 1) !default;
$link-color-visited-dark: rgba(186, 142, 240) !default;

$code-background: lighten($gray-200, 4) !default;
$code-background-dark: darken($body-background-dark, 3) !default;
$code-background: $gray-100 !default;
$code-background-dark: color.scale($body-background-dark, $lightness: -15%) !default;

$header-font-family: "Metropolis", sans-serif !default;
$header-height: 3.5rem !default;
Expand Down
4 changes: 2 additions & 2 deletions src/sass/_mobile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}

&__list {
background: lighten($second-color, 10%);
background: color.scale($second-color, $lightness: 10%);
flex-direction: column;
justify-content: center;
max-height: 0;
Expand All @@ -42,7 +42,7 @@
&:hover,
&:visited:hover,
&.is-active {
background: lighten($second-color, 5%);
background: color.scale($second-color, $lightness: 5%);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/sass/_shortcodes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -187,23 +187,23 @@
@each $name, $color in $hint-colors {
&.#{$name} {
border-left-color: $color;
background-color: scale-color($color, $lightness: 95%, $saturation: -30%);
background-color: color.scale($color, $lightness: 95%, $saturation: -30%);
color: $body-font-color;
padding: 0;

code,
pre {
background-color: scale-color($color, $lightness: 80%, $saturation: -75%);
background-color: color.scale($color, $lightness: 80%, $saturation: -75%);
color: $code-font-color;
}
}
}

&__title {
padding: $padding-4 $padding-16;
background-color: scale-color($gray-600, $alpha: -95%);
background-color: color.scale($gray-600, $alpha: -95%);
font-weight: bold;
color: scale-color($body-font-color, $alpha: -15%);
color: color.scale($body-font-color, $alpha: -15%);

i.fa::after {
content: attr(title);
Expand Down Expand Up @@ -273,8 +273,8 @@

@each $name, $color in $hint-colors {
&__tag.#{$name} {
border-color: scale-color($color, $lightness: 90%, $saturation: -30%);
background-color: scale-color($color, $lightness: 95%, $saturation: -30%);
border-color: color.scale($color, $lightness: 90%, $saturation: -30%);
background-color: color.scale($color, $lightness: 95%, $saturation: -30%);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/sass/main.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@use "sass:map";
@use "sass:meta";
@use "sass:color";

@import "_defaults";
@import "_color_mode";
Expand Down
2 changes: 2 additions & 0 deletions src/sass/mobile.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "sass:color";

@import "_defaults";

@import "_mobile";
2 changes: 2 additions & 0 deletions src/sass/print.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "sass:color";

@import "_defaults";

@import "_print";

0 comments on commit c870c65

Please sign in to comment.