Skip to content

Commit

Permalink
refactor(functions/color): add $prefix argument to customize css va…
Browse files Browse the repository at this point in the history
…riable prefix.
  • Loading branch information
sciborrudnicki committed Jun 7, 2022
1 parent dfdc843 commit 7e84edc
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/functions/_color.scss
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})
);
}

0 comments on commit 7e84edc

Please sign in to comment.