forked from picturepan2/spectre
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(functions/color): add
$prefix
argument to customize css va…
…riable prefix.
- Loading branch information
1 parent
dfdc843
commit 7e84edc
Showing
1 changed file
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
@use '../variables' as *; | ||
|
||
// Get color from css variable. | ||
@function color($name, $hue: 0deg, $lightness: 0%, $saturation: 0%, $alpha: 1) { | ||
@function color( | ||
$name, | ||
$hue: 0deg, | ||
$lightness: 0%, | ||
$saturation: 0%, | ||
$alpha: 1, | ||
$prefix: $var-prefix | ||
) { | ||
@return hsla( | ||
calc(var(--s-#{$name}-h) + #{$hue}), | ||
calc(var(--s-#{$name}-s) + #{$saturation}), | ||
calc(var(--s-#{$name}-l) + #{$lightness}), | ||
calc(var(--s-#{$name}-a) * #{$alpha}) | ||
calc(var(--#{$prefix}-#{$name}-h) + #{$hue}), | ||
calc(var(--#{$prefix}-#{$name}-s) + #{$saturation}), | ||
calc(var(--#{$prefix}-#{$name}-l) + #{$lightness}), | ||
calc(var(--#{$prefix}-#{$name}-a) * #{$alpha}) | ||
); | ||
} |