Skip to content

Commit

Permalink
fix(colors): update sass inverse color function
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Feb 14, 2016
1 parent 1e0df92 commit 55ef5a8
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions ionic/util/functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,34 @@
// Color Functions
// --------------------------------------------------

@function inverse($color-value) {
$lightness: lightness($color-value);
@function brightness($color-value) {
@return (red($color-value) * 0.299 + green($color-value) * 0.587 + blue($color-value) * 0.114) / 255 * 100%;
}


@function inverse($color-value, $dark: black, $light: white) {
$brightness: brightness($color-value);
$red: red($color-value);
$green: green($color-value);

@if ($lightness > 65 or $green > 220 or ($red > 240 and $green > 180)) {
@return black;
@if ($brightness > 79) {
@return $dark;
}

@return white;
}
@if ($green > 240) {
@return $dark;
}

@if ($red > 220 and $green > 180) {
@return $dark;
}

@function toolbar-button-inverse($color-value) {
$lightness: lightness($color-value);
$red: red($color-value);
$green: green($color-value);
@return $light;
}

@if ($lightness > 65 or $green > 220 or ($red > 240 and $green > 180)) {
@return $toolbar-md-button-color;
}

@return white;
@function toolbar-button-inverse($color-value) {
@return inverse($color-value, $dark: $toolbar-md-button-color, $light: white);
}


Expand Down

0 comments on commit 55ef5a8

Please sign in to comment.