Sha256: 72ae35c2ccae8704f5d24f0c7193c3b1e26b637e3e8322132fb2089153988291

Contents?: true

Size: 1.7 KB

Versions: 2

Compression:

Stored size: 1.7 KB

Contents

@charset "UTF-8";

/// Switches between two colors based on the lightness of a another color. Great
/// for building button styles.
///
/// @argument {color} $base-color
///   The color to evaluate lightness against.
///
/// @argument {color} $dark-color [#000]
///   The color to be output when `$base-color` is light.
///
/// @argument {color} $light-color [#fff]
///   The color to be output when `$base-color` is dark.
///
/// @return {color}
///
/// @example scss
///   .first-element {
///     color: contrast-switch(#bae6e6);
///   }
///
///   .second-element {
///     $button-color: #2d72d9;
///     background-color: $button-color;
///     color: contrast-switch($button-color, #222, #eee);
///   }
///
/// @example css
///   .first-element {
///     color: #000;
///   }
///
///   .second-element {
///     background-color: #2d72d9;
///     color: #eee;
///   }
///
/// @require {function} _is-light
///
/// @since 5.0.0

@function contrast-switch(
    $base-color,
    $dark-color: _retrieve-bourbon-setting("contrast-switch-dark-color"),
    $light-color: _retrieve-bourbon-setting("contrast-switch-light-color")
  ) {

  @if not _is-color($base-color) {
    @error "`#{$base-color}` is not a valid color for the `$base-color` " +
           "argument in the `contrast-switch` function.";
  } @else if not _is-color($dark-color) {
    @error "`#{$dark-color}` is not a valid color for the `$dark-color` " +
           "argument in the `contrast-switch` function.";
  } @else if not _is-color($light-color) {
    @error "`#{$light-color}` is not a valid color for the `$light-color` " +
           "argument in the `contrast-switch` function.";
  } @else {
    @return if(_is-light($base-color), $dark-color, $light-color);
  }
}

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
garth-jekyll-theme-0.1.9 _sass/bourbon/bourbon/library/_contrast-switch.scss
bourbon-5.0.0.beta.6 core/bourbon/library/_contrast-switch.scss