Skip to content

Commit

Permalink
refactor: use color scale instead of darken function (#604)
Browse files Browse the repository at this point in the history
This PR replaces all usages of `darken()` with the Sass module color scale method `color.scale()`.

Fixes #597
  • Loading branch information
sebnitu committed May 29, 2021
1 parent d0766d9 commit ce639fd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 36 deletions.
32 changes: 16 additions & 16 deletions docs/dist/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/dist/styles.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/styles.min.css

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions packages/button/src/_button_color.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
@use "@vrembem/core";
@use "./variables" as var;

Expand Down Expand Up @@ -51,15 +52,15 @@ $_v: var.$prefix-modifier-value;
color: core.$white;

&:hover {
background: darken(core.$primary, 6%);
background: color.scale(core.$primary, $lightness: -6%);
}

&:focus {
background: darken(core.$primary, 9%);
background: color.scale(core.$primary, $lightness: -9%);
}

&:active {
background: darken(core.$primary, 12%);
background: color.scale(core.$primary, $lightness: -12%);
}

&.is-loading::after {
Expand All @@ -72,15 +73,15 @@ $_v: var.$prefix-modifier-value;
color: core.$white;

&:hover {
background: darken(core.$secondary, 6%);
background: color.scale(core.$secondary, $lightness: -6%);
}

&:focus {
background: darken(core.$secondary, 9%);
background: color.scale(core.$secondary, $lightness: -9%);
}

&:active {
background: darken(core.$secondary, 12%);
background: color.scale(core.$secondary, $lightness: -12%);
}

&.is-loading::after {
Expand Down
25 changes: 13 additions & 12 deletions packages/icon-action/src/_icon-action_state.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
@use "@vrembem/core";
@use "./variables" as var;

Expand All @@ -10,15 +11,15 @@ $_v: var.$prefix-modifier-value;
color: core.color-switch(core.$info);

&:hover {
background: darken(core.$info, 10%);
background: color.scale(core.$info, $lightness: -10%);
}

&:focus {
background: darken(core.$info, 20%);
background: color.scale(core.$info, $lightness: -20%);
}

&:active {
background: darken(core.$info, 20%);
background: color.scale(core.$info, $lightness: -30%);
}
}

Expand All @@ -27,15 +28,15 @@ $_v: var.$prefix-modifier-value;
color: core.color-switch(core.$success);

&:hover {
background: darken(core.$success, 10%);
background: color.scale(core.$success, $lightness: -10%);
}

&:focus {
background: darken(core.$success, 20%);
background: color.scale(core.$success, $lightness: -20%);
}

&:active {
background: darken(core.$success, 20%);
background: color.scale(core.$success, $lightness: -30%);
}
}

Expand All @@ -44,15 +45,15 @@ $_v: var.$prefix-modifier-value;
color: core.color-switch(core.$caution);

&:hover {
background: darken(core.$caution, 5%);
background: color.scale(core.$caution, $lightness: -10%);
}

&:focus {
background: darken(core.$caution, 10%);
background: color.scale(core.$caution, $lightness: -20%);
}

&:active {
background: darken(core.$caution, 10%);
background: color.scale(core.$caution, $lightness: -30%);
}
}

Expand All @@ -61,14 +62,14 @@ $_v: var.$prefix-modifier-value;
color: core.color-switch(core.$danger);

&:hover {
background: darken(core.$danger, 10%);
background: color.scale(core.$danger, $lightness: -10%);
}

&:focus {
background: darken(core.$danger, 20%);
background: color.scale(core.$danger, $lightness: -20%);
}

&:active {
background: darken(core.$danger, 20%);
background: color.scale(core.$danger, $lightness: -30%);
}
}

0 comments on commit ce639fd

Please sign in to comment.