// ------------------------------------------------------------- * // Function to return a percentage rounded down to 2 deimals // --------------------------------------------------------- // // @function percentage-round // // Example use: // ------------------- // .selector{ // width: percentage-round( 2/3 ); // returns 66.66% // } // // ------------------------------------------------------------- * @function percentage-round( $value ) { @return floor( percentage( $value ) * 100 ) / 100; } @function return-key( $key, $array ) { @each $item in $array { @if ( nth( $item, 1 ) == $key ){ @return nth( $item, 2 ); } } } @function comparable-multiple( $array ) { $prev: false; @if length( $array ) < 2 { @warn "You need at least two values in order to do a comparison!"; } @each $item in $array { @if $prev { @if not comparable( $prev, $item ) { @return false; } } @else { $prev: $item; } } @return true; } @function remove-units( $value ) { $units: "%" 1%, "in" 1in, "cm" 1cm, "mm" 1mm, "em" 1em, "rem" 1rem, "ch" 1ch, "ex" 1ex, "pt" 1pt, "pc" 1pc, "px" 1px, "vw" 1vw, "vh" 1vh, "vmin" 1vmin, "vmax" 1vmax; @each $unit in $units { @if unit($value) == nth( $unit, 1 ) { @return $value / nth( $unit, 2 ); } } // @return $value / unit($value); }