Skip to content

Commit 74412b7

Browse files
committed
fixed sass color deprecations
1 parent 6bc3f53 commit 74412b7

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

scss/_global.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,14 @@ $global-color-pick-contrast-tolerance: 0 !default;
221221

222222
// Reset <button> styles created by most browsers
223223
button {
224+
@include disable-mouse-outline;
224225
padding: 0;
225226
appearance: none;
226227
border: 0;
227228
border-radius: $global-radius;
228229
background: transparent;
229230
line-height: 1;
230231
cursor: $global-button-cursor;
231-
@include disable-mouse-outline;
232232
}
233233

234234
// Prevent text overflow on pre

scss/components/_table.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/// @group table
99
////
1010

11+
@use "sass:color";
12+
1113
/// Default color for table background.
1214
/// @type Color
1315
$table-background: $white !default;
@@ -30,11 +32,11 @@ $table-hover-scale: 2% !default;
3032

3133
/// Default color of standard rows on hover.
3234
/// @type List
33-
$table-row-hover: darken($table-background, $table-hover-scale) !default;
35+
$table-row-hover: color.adjust($table-background, $lightness: -$table-hover-scale) !default;
3436

3537
/// Default color of striped rows on hover.
3638
/// @type List
37-
$table-row-stripe-hover: darken($table-background, $table-color-scale + $table-hover-scale) !default;
39+
$table-row-stripe-hover: color.adjust($table-background, $lightness: -($table-color-scale + $table-hover-scale)) !default;
3840

3941
/// If `true`, tables are striped by default and an .unstriped class is created. If `false`, a .striped class is created.
4042
/// @type Boolean
@@ -54,15 +56,15 @@ $table-head-background: smart-scale($table-background, $table-color-scale * 0.5)
5456

5557
/// Default color of header rows on hover.
5658
/// @type List
57-
$table-head-row-hover: darken($table-head-background, $table-hover-scale) !default;
59+
$table-head-row-hover: color.adjust($table-head-background, $lightness: -$table-hover-scale) !default;
5860

5961
/// Default color for footer background.
6062
/// @type Color
6163
$table-foot-background: smart-scale($table-background, $table-color-scale) !default;
6264

6365
/// Default color of footer rows on hover.
6466
/// @type List
65-
$table-foot-row-hover: darken($table-foot-background, $table-hover-scale) !default;
67+
$table-foot-row-hover: color.adjust($table-foot-background, $lightness: -$table-hover-scale) !default;
6668

6769
/// Default font color for header.
6870
/// @type Color

scss/settings/_settings.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
// 55. Top Bar
6161
// 57. Xy Grid
6262

63+
@use "sass:color";
6364
@import 'util/util';
6465

6566
// 1. Global
@@ -803,15 +804,15 @@ $table-color-scale: 5%;
803804
$table-border: 1px solid smart-scale($table-background, $table-color-scale);
804805
$table-padding: rem-calc(8 10 10);
805806
$table-hover-scale: 2%;
806-
$table-row-hover: darken($table-background, $table-hover-scale);
807-
$table-row-stripe-hover: darken($table-background, $table-color-scale + $table-hover-scale);
807+
$table-row-hover: color.adjust($table-background, $lightness: -$table-hover-scale);
808+
$table-row-stripe-hover: color.adjust($table-background, $lightness: -($table-color-scale + $table-hover-scale));
808809
$table-is-striped: true;
809810
$table-striped-background: smart-scale($table-background, $table-color-scale);
810811
$table-stripe: even;
811812
$table-head-background: smart-scale($table-background, $table-color-scale * 0.5);
812-
$table-head-row-hover: darken($table-head-background, $table-hover-scale);
813+
$table-head-row-hover: color.adjust($table-head-background, $lightness: -$table-hover-scale);
813814
$table-foot-background: smart-scale($table-background, $table-color-scale);
814-
$table-foot-row-hover: darken($table-foot-background, $table-hover-scale);
815+
$table-foot-row-hover: color.adjust($table-head-background, $lightness: -$table-hover-scale);
815816
$table-head-font-color: $body-font-color;
816817
$table-foot-font-color: $body-font-color;
817818
$show-header-for-stacked: false;

scss/util/_color.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// https://get.foundation
33
// Licensed under MIT Open Source
44

5+
@use "sass:color";
56
@import 'math';
67

78
$contrast-warnings: true !default;
@@ -25,7 +26,11 @@ $success-color: null !default;
2526
@function color-luminance($color) {
2627
// Adapted from: https://github.com/LeaVerou/contrast-ratio/blob/gh-pages/color.js
2728
// Formula: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
28-
$rgba: red($color), green($color), blue($color);
29+
$red : round(color.channel($color, "red", $space: rgb));
30+
$green : round(color.channel($color, "green", $space: rgb));
31+
$blue : round(color.channel($color, "blue", $space: rgb));
32+
33+
$rgba: $red, $green, $blue;
2934
$rgba2: ();
3035

3136
@for $i from 1 through 3 {
@@ -96,7 +101,7 @@ $success-color: null !default;
96101
///
97102
/// @returns {Color} A scaled color.
98103
@function smart-scale($color, $scale: 5%, $threshold: 40%) {
99-
@if lightness($color) > $threshold {
104+
@if color.channel($color, "lightness", $space: hsl) > $threshold {
100105
$scale: -$scale;
101106
}
102107
@return scale-color($color, $lightness: $scale);

scss/util/_mixins.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
/// @group functions
77
////
88

9+
@use "sass:color";
10+
911
// Patch to fix issue #12080
1012
$-zf-bp-value: null;
1113

@@ -146,12 +148,15 @@ $-zf-bp-value: null;
146148
///
147149
/// @param {Color} $color [$black] - Color to use for the triangle.
148150
@mixin background-triangle($color: $black) {
149-
$rgb: 'rgb%28#{round(red($color))}, #{round(green($color))}, #{round(blue($color))}%29';
151+
$red : round(color.channel($color, "red", $space: rgb));
152+
$green : round(color.channel($color, "green", $space: rgb));
153+
$blue : round(color.channel($color, "blue", $space: rgb));
154+
$rgb : 'rgb%28#{$red}, #{$green}, #{$blue}%29';
150155

151156
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="24" viewBox="0 0 32 24"><polygon points="0,0 32,0 16,24" style="fill: #{$rgb}"></polygon></svg>');
152157

153158
@media screen and (min-width: 0\0) {
154-
@if lightness($color) < 60% {
159+
@if color.channel($color, "lightness", $space: hsl) < 60% {
155160
// White triangle
156161
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIpJREFUeNrEkckNgDAMBBfRkEt0ObRBBdsGXUDgmQfK4XhH2m8czQAAy27R3tsw4Qfe2x8uOO6oYLb6GlOor3GF+swURAOmUJ+RwtEJs9WvTGEYxBXqI1MQAZhCfUQKRzDMVj+TwrAIV6jvSUEkYAr1LSkcyTBb/V+KYfX7xAeusq3sLDtGH3kEGACPWIflNZfhRQAAAABJRU5ErkJggg==');
157162
}

0 commit comments

Comments
 (0)