diff options
Diffstat (limited to 'src/_gradients.scss')
| -rw-r--r-- | src/_gradients.scss | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/_gradients.scss b/src/_gradients.scss index 7c52d63..657efa2 100644 --- a/src/_gradients.scss +++ b/src/_gradients.scss | |||
| @@ -15,6 +15,9 @@ | |||
| 15 | /// @access public | 15 | /// @access public |
| 16 | //// | 16 | //// |
| 17 | 17 | ||
| 18 | @use 'sass:math'; | ||
| 19 | @use 'sass:meta'; | ||
| 20 | |||
| 18 | /// | 21 | /// |
| 19 | /// Number of intermediate color stops generated to achieve easing. | 22 | /// Number of intermediate color stops generated to achieve easing. |
| 20 | /// A higher value results in better quality, but also much more generated code. | 23 | /// A higher value results in better quality, but also much more generated code. |
| @@ -340,7 +343,7 @@ $iro-easing-gradient-steps: 10 !default; | |||
| 340 | $distance: $next-stop-pos - $prev-stop-pos; | 343 | $distance: $next-stop-pos - $prev-stop-pos; |
| 341 | 344 | ||
| 342 | @for $i from 1 through $iro-easing-gradient-steps { | 345 | @for $i from 1 through $iro-easing-gradient-steps { |
| 343 | $perc: $i / $iro-easing-gradient-steps; | 346 | $perc: math.div($i, $iro-easing-gradient-steps); |
| 344 | 347 | ||
| 345 | $color: null; | 348 | $color: null; |
| 346 | $pos: $prev-stop-pos + $perc * $distance; | 349 | $pos: $prev-stop-pos + $perc * $distance; |
| @@ -359,20 +362,20 @@ $iro-easing-gradient-steps: 10 !default; | |||
| 359 | 362 | ||
| 360 | @if type-of($prev-stop-pos) != number { | 363 | @if type-of($prev-stop-pos) != number { |
| 361 | // must be calc() | 364 | // must be calc() |
| 362 | @if (type-of($prev-stop-pos) != string) or (str-index($prev-stop-pos, 'calc(') != 1) { | 365 | @if type-of($prev-stop-pos) != calculation { |
| 363 | @error 'Invalid color stop position: #{inspect($prev-stop-pos)}'; | 366 | @error 'Invalid color stop position: #{inspect($prev-stop-pos)}'; |
| 364 | } | 367 | } |
| 365 | 368 | ||
| 366 | $prev-stop-pos: str-slice($prev-stop-pos, 6, str-length($prev-stop-pos) - 1); | 369 | $prev-stop-pos: meta.calc-args($prev-stop-pos); |
| 367 | } | 370 | } |
| 368 | 371 | ||
| 369 | @if type-of($next-stop-pos) != number { | 372 | @if type-of($next-stop-pos) != number { |
| 370 | // must be calc() | 373 | // must be calc() |
| 371 | @if (type-of($next-stop-pos) != string) or (str-index($next-stop-pos, 'calc(') != 1) { | 374 | @if type-of($next-stop-pos) != calculation { |
| 372 | @error 'Invalid color stop position: #{inspect($next-stop-pos)}'; | 375 | @error 'Invalid color stop position: #{inspect($next-stop-pos)}'; |
| 373 | } | 376 | } |
| 374 | 377 | ||
| 375 | $next-stop-pos: str-slice($next-stop-pos, 6, str-length($next-stop-pos) - 1); | 378 | $next-stop-pos: meta.calc-args($next-stop-pos); |
| 376 | } | 379 | } |
| 377 | 380 | ||
| 378 | @for $i from 1 through $iro-easing-gradient-steps { | 381 | @for $i from 1 through $iro-easing-gradient-steps { |
| @@ -454,20 +457,20 @@ $iro-easing-gradient-steps: 10 !default; | |||
| 454 | 457 | ||
| 455 | @if type-of($prev-stop-pos) != number { | 458 | @if type-of($prev-stop-pos) != number { |
| 456 | // must be calc() | 459 | // must be calc() |
| 457 | @if (type-of($prev-stop-pos) != string) or (str-index($prev-stop-pos, 'calc(') != 1) { | 460 | @if type-of($prev-stop-pos) != calculation { |
| 458 | @error 'Invalid color stop position: #{inspect($prev-stop-pos)}'; | 461 | @error 'Invalid color stop position: #{inspect($prev-stop-pos)}'; |
| 459 | } | 462 | } |
| 460 | 463 | ||
| 461 | $prev-stop-pos: str-slice($prev-stop-pos, 6, str-length($prev-stop-pos) - 1); | 464 | $prev-stop-pos: meta.calc-args($prev-stop-pos); |
| 462 | } | 465 | } |
| 463 | 466 | ||
| 464 | @if type-of($next-stop-pos) != number { | 467 | @if type-of($next-stop-pos) != number { |
| 465 | // must be calc() | 468 | // must be calc() |
| 466 | @if (type-of($next-stop-pos) != string) or (str-index($next-stop-pos, 'calc(') != 1) { | 469 | @if type-of($next-stop-pos) != calculation { |
| 467 | @error 'Invalid color stop position: #{inspect($next-stop-pos)}'; | 470 | @error 'Invalid color stop position: #{inspect($next-stop-pos)}'; |
| 468 | } | 471 | } |
| 469 | 472 | ||
| 470 | $next-stop-pos: str-slice($next-stop-pos, 6, str-length($next-stop-pos) - 1); | 473 | $next-stop-pos: meta.calc-args($next-stop-pos); |
| 471 | } | 474 | } |
| 472 | 475 | ||
| 473 | @for $i from 1 through $steps { | 476 | @for $i from 1 through $steps { |
| @@ -550,20 +553,20 @@ $iro-easing-gradient-steps: 10 !default; | |||
| 550 | 553 | ||
| 551 | @if type-of($prev-stop-pos) != number { | 554 | @if type-of($prev-stop-pos) != number { |
| 552 | // must be calc() | 555 | // must be calc() |
| 553 | @if (type-of($prev-stop-pos) != string) or (str-index($prev-stop-pos, 'calc(') != 1) { | 556 | @if type-of($prev-stop-pos) != calculation { |
| 554 | @error 'Invalid color stop position: #{inspect($prev-stop-pos)}'; | 557 | @error 'Invalid color stop position: #{inspect($prev-stop-pos)}'; |
| 555 | } | 558 | } |
| 556 | 559 | ||
| 557 | $prev-stop-pos: str-slice($prev-stop-pos, 6, str-length($prev-stop-pos) - 1); | 560 | $prev-stop-pos: meta.calc-args($prev-stop-pos); |
| 558 | } | 561 | } |
| 559 | 562 | ||
| 560 | @if type-of($next-stop-pos) != number { | 563 | @if type-of($next-stop-pos) != number { |
| 561 | // must be calc() | 564 | // must be calc() |
| 562 | @if (type-of($next-stop-pos) != string) or (str-index($next-stop-pos, 'calc(') != 1) { | 565 | @if type-of($next-stop-pos) != calculation { |
| 563 | @error 'Invalid color stop position: #{inspect($next-stop-pos)}'; | 566 | @error 'Invalid color stop position: #{inspect($next-stop-pos)}'; |
| 564 | } | 567 | } |
| 565 | 568 | ||
| 566 | $next-stop-pos: str-slice($next-stop-pos, 6, str-length($next-stop-pos) - 1); | 569 | $next-stop-pos: meta.calc-args($next-stop-pos); |
| 567 | } | 570 | } |
| 568 | 571 | ||
| 569 | @for $i from 1 through length($stops) { | 572 | @for $i from 1 through length($stops) { |
