Sha256: 683495fc366fa1ba3eccae9fc241998861311df0f0ca0d48ba8859cb819a321e

Contents?: true

Size: 1.81 KB

Versions: 26

Compression:

Stored size: 1.81 KB

Contents

@function color($value)
  @if type-of($value) == color
    @return true
  @else
    @return null

@function color_list($values)
  @if list($values)
    @each $value in $values
      @if color($value)
        @return true
      @else
        @return null
  @else
    @return null

@function optional_color_list($values)
  @if color($values)
    @return true
  @else if color_list($values)
    @return true
  @else
    @return null

// tint & shade
// http://bourbon.io/docs/#tint-shade

@function tint($color, $percent)
  @return mix(white, $color, $percent)

@function shade($color, $percent)
  @return mix(black, $color, $percent)

// Adapted from: https://gist.github.com/voxpelli/6304812
@function luma($color)
  @if color($color)
    $rgba: red($color), green($color), blue($color)
    $rgba2: ()
    @for $i from 1 through 3
      $rgb: nth($rgba, $i)
      $rgb: $rgb / 255
      $rgb: if($rgb < .03928, $rgb / 12.92, pow(($rgb + .055) / 1.055, 2.4))
      $rgba2: append($rgba2, $rgb)
    @return (.2126 * nth($rgba2, 1) + .7152 * nth($rgba2, 2) + .0722 * nth($rgba2, 3))*100
  @else
    @return $color


@function luma_value($color-1, $color-2: null)
  @if $color-2
    @return abs(luma($color-1) - luma($color-2))
  @else
    @return luma($color-1)

@function luma_which($color)
  @return if(luma($color) < 51, dark, bright)

@function luma_bright($color)
  @if luma($color) < 51
    @return null
  @else
    @return true

@function luma_dark($color)
  @if luma($color) < 51
    @return true
  @else
    @return null

$luma-contrast-bright-color: $dark-text !default
$luma-contrast-dark-color: $bright-text !default

@function luma_contrast_color($color)
  @if luma_bright($color)
    @return if($luma-contrast-bright-color, $luma-contrast-bright-color, white)
  @else
    @return if($luma-contrast-dark-color, $luma-contrast-dark-color, black)

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
oulu-0.12.33 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.32 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.31 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.30 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.29 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.28 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.27 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.26 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.25 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.24 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.23 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.22 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.21 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.20 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.19 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.18 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.17 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.16 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.15 app/assets/stylesheets/settings/functions/_color.sass
oulu-0.12.14 app/assets/stylesheets/settings/functions/_color.sass