Q
Version: 1.1.alpha.0
Source on Github

Compass Color Brightness

This file can be imported using: @import "compass/utilities/color/brightness"

Functions

view source

@function brightness($color)
  @if type-of($color) == color
    @return (red($color) * 0.299 + green($color) * 0.587 + blue($color) * 0.114) / 255 * 100%
  @else
    @return unquote("brightness(#{$color})")
@function brightness($color) {
  @if type-of($color) == color {
    @return (red($color) * 0.299 + green($color) * 0.587 + blue($color) * 0.114) / 255 * 100%;
  }
  @else {
    @return unquote("brightness(#{$color})");
  }
}

Computes the "brightness" of a color

Brightness is similiar to lightness in HSL but more closely approximates how humans perceive the intensity of the different RGB components of a color. Brightness is sometimes called luminance.

Returns a number between 0% and 100%, where 100% is fully bright (white) and 0% is fully dark (black) for color values.

For numbers and percentages it returns the same value to be used in @include filter(brightness(1.1)).