Files
ionic-framework/ionic/util/functions.scss

72 lines
1.5 KiB
SCSS

// Color Functions
// --------------------------------------------------
@function inverse($color-value) {
$lightness: lightness($color-value);
$red: red($color-value);
$green: green($color-value);
@if ($lightness > 65 or $green > 220 or ($red > 240 and $green > 180)) {
@return black;
}
@return white;
}
@function toolbar-button-inverse($color-value) {
$lightness: lightness($color-value);
$red: red($color-value);
$green: green($color-value);
@if ($lightness > 65 or $green > 220 or ($red > 240 and $green > 180)) {
@return $toolbar-md-button-color;
}
@return white;
}
@function color-shade($color-value, $amount:8%) {
$lightness: lightness($color-value);
$shade: white;
@if ($lightness > 50) {
$shade: black;
}
@return mix($shade, $color-value, $amount);
}
// Copy Colors Map
// --------------------------------------------------
@function copy-colors($colors-map) {
@return map-merge($colors-map, ());
}
// String Replace Function
// --------------------------------------------------
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
// URL Encode Function
// --------------------------------------------------
@function url-encode($val) {
@return str-replace($val, ' ', '%20');
}