functions.sass (bulma-0.9.2) | : | functions.sass (bulma-0.9.3) | ||
---|---|---|---|---|
skipping to change at line 61 | skipping to change at line 61 | |||
@return $merged-colors | @return $merged-colors | |||
@function powerNumber($number, $exp) | @function powerNumber($number, $exp) | |||
$value: 1 | $value: 1 | |||
@if $exp > 0 | @if $exp > 0 | |||
@for $i from 1 through $exp | @for $i from 1 through $exp | |||
$value: $value * $number | $value: $value * $number | |||
@else if $exp < 0 | @else if $exp < 0 | |||
@for $i from 1 through -$exp | @for $i from 1 through -$exp | |||
$value: $value / $number | $value: divide($value, $number) | |||
@return $value | @return $value | |||
@function colorLuminance($color) | @function colorLuminance($color) | |||
@if type-of($color) != 'color' | @if type-of($color) != 'color' | |||
@return 0.55 | @return 0.55 | |||
$color-rgb: ('red': red($color),'green': green($color),'blue': blue($color)) | $color-rgb: ('red': red($color),'green': green($color),'blue': blue($color)) | |||
@each $name, $value in $color-rgb | @each $name, $value in $color-rgb | |||
$adjusted: 0 | $adjusted: 0 | |||
$value: $value / 255 | $value: divide($value, 255) | |||
@if $value < 0.03928 | @if $value < 0.03928 | |||
$value: $value / 12.92 | $value: divide($value, 12.92) | |||
@else | @else | |||
$value: ($value + .055) / 1.055 | $value: divide(($value + .055), 1.055) | |||
$value: powerNumber($value, 2) | $value: powerNumber($value, 2) | |||
$color-rgb: map-merge($color-rgb, ($name: $value)) | $color-rgb: map-merge($color-rgb, ($name: $value)) | |||
@return (map-get($color-rgb, 'red') * .2126) + (map-get($color-rgb, 'green') * .7152) + (map-get($color-rgb, 'blue') * .0722) | @return (map-get($color-rgb, 'red') * .2126) + (map-get($color-rgb, 'green') * .7152) + (map-get($color-rgb, 'blue') * .0722) | |||
@function findColorInvert($color) | @function findColorInvert($color) | |||
@if (colorLuminance($color) > 0.55) | @if (colorLuminance($color) > 0.55) | |||
@return rgba(#000, 0.7) | @return rgba(#000, 0.7) | |||
@else | @else | |||
@return #fff | @return #fff | |||
skipping to change at line 116 | skipping to change at line 116 | |||
@function bulmaDarken($color, $amount) | @function bulmaDarken($color, $amount) | |||
@if type-of($color) != 'color' | @if type-of($color) != 'color' | |||
@return $color | @return $color | |||
@return darken($color, $amount) | @return darken($color, $amount) | |||
@function bulmaLighten($color, $amount) | @function bulmaLighten($color, $amount) | |||
@if type-of($color) != 'color' | @if type-of($color) != 'color' | |||
@return $color | @return $color | |||
@return lighten($color, $amount) | @return lighten($color, $amount) | |||
// Custom divide function by @mdo from https://github.com/twbs/bootstrap/pull/34 | ||||
245 | ||||
// Replaces old slash division deprecated in Dart Sass | ||||
@function divide($dividend, $divisor, $precision: 10) | ||||
$sign: if($dividend > 0 and $divisor > 0, 1, -1) | ||||
$dividend: abs($dividend) | ||||
$divisor: abs($divisor) | ||||
$quotient: 0 | ||||
$remainder: $dividend | ||||
@if $dividend == 0 | ||||
@return 0 | ||||
@if $divisor == 0 | ||||
@error "Cannot divide by 0" | ||||
@if $divisor == 1 | ||||
@return $dividend | ||||
@while $remainder >= $divisor | ||||
$quotient: $quotient + 1 | ||||
$remainder: $remainder - $divisor | ||||
@if $remainder > 0 and $precision > 0 | ||||
$remainder: divide($remainder * 10, $divisor, $precision - 1) * .1 | ||||
@return ($quotient + $remainder) * $sign | ||||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |