Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
fix(tooltip): use contrast function to determine text color based on …
Browse files Browse the repository at this point in the history
…background
  • Loading branch information
joneff committed Jan 25, 2018
1 parent 9986149 commit 53c6306
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions scss/tooltip/_theme.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
$is-light: lightness($bg-color) > 50;

$resolved-tooltip-text: if($is-light, $tooltip-color, $tooltip-bg);
$resolved-tooltip-bg: if($is-light, $tooltip-bg, $tooltip-color);

@include exports("tooltip/theme") {

.k-tooltip {
color: $resolved-tooltip-text;
background-color: $resolved-tooltip-bg;
color: contrast-wcag($tooltip-bg);
background-color: $tooltip-bg;
@include border-radius($border-radius);
}

Expand All @@ -16,9 +11,9 @@ $resolved-tooltip-bg: if($is-light, $tooltip-bg, $tooltip-color);
}


.k-callout-n { border-bottom-color: $resolved-tooltip-bg; }
.k-callout-e { border-left-color: $resolved-tooltip-bg; }
.k-callout-s { border-top-color: $resolved-tooltip-bg; }
.k-callout-w { border-right-color: $resolved-tooltip-bg; }
.k-callout-n { border-bottom-color: $tooltip-bg; }
.k-callout-e { border-left-color: $tooltip-bg; }
.k-callout-s { border-top-color: $tooltip-bg; }
.k-callout-w { border-right-color: $tooltip-bg; }

}

0 comments on commit 53c6306

Please sign in to comment.