Skip to content

Commit

Permalink
added tofixed sass function
Browse files Browse the repository at this point in the history
  • Loading branch information
woodcox authored Mar 1, 2024
1 parent cb0e254 commit cedd219
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/style/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,19 @@ body [data-density-shift] [data-density-shift] { ... }
$spacescale: 2;
$typescale: 1.25;

@function tofixed($value, $decimal-place: 3) {
$pow: math.pow(10, $decimal-place);
@return math.div(round($value * $pow), $pow);
}

@function space-calc($n) {
@return math.pow($spacescale, $n);
$pow: math.pow($spacescale, $n);
@return tofixed($pow);
}

@function type-calc($n) {
@return math.pow($typescale, $n);
$pow: math.pow($typescale, $n);
@return tofixed($pow);
}

@mixin spacing-vars($selector, $levels, $attr-sel: '[data-density-shift]') {
Expand Down

0 comments on commit cedd219

Please sign in to comment.