Sha256: 0b7172627f8ecd96326157974e65498090edbd658b31961bf192d2f8eaad3a8f
Contents?: true
Size: 1.65 KB
Versions: 26
Compression:
Stored size: 1.65 KB
Contents
@import "compass/utilities/color/brightness"; $contrasted-dark-default: #000 !default; $contrasted-light-default: #fff !default; // Returns either the `$light` or `$dark` color // by deciding which contrasts more with `$color`. // // E.g. This can be used to select the more readable foreground color // for a given background color. // // `$dark` defaults to black and `$light` defaults to white. // // When `$color` is `null`, this function returns `null`. @function contrast-color( $color, $dark: $contrasted-dark-default, $light: $contrasted-light-default, $threshold: null ) { @if $threshold { // Deprecated in Compass 0.13 @warn "The $threshold argment to contrast-color is no longer needed and will be removed in the next release." } @if $color == null { @return null; } @else { $color-brightness: brightness($color); $dark-text-brightness: brightness($dark); $light-text-brightness: brightness($light); @return if(abs($color-brightness - $light-text-brightness) > abs($color-brightness - $dark-text-brightness), $light, $dark); } } // Sets the specified background color and calculates a dark or light // contrasted text color. The arguments are passed through to the // [contrast-color function](#function-contrast-color). @mixin contrasted( $background-color, $dark: $contrasted-dark-default, $light: $contrasted-light-default, $threshold: null ) { @if $threshold { // Deprecated in Compass 0.13 @warn "The $threshold argment to contrasted is no longer needed and will be removed in the next release." } background-color: $background-color; color: contrast-color($background-color, $dark, $light); }
Version data entries
26 entries across 26 versions & 4 rubygems