Skip to content

Instantly share code, notes, and snippets.

@cimmanon
Last active August 29, 2015 14:21
Show Gist options
  • Save cimmanon/c76b8f9fd4a2118e06af to your computer and use it in GitHub Desktop.
Save cimmanon/c76b8f9fd4a2118e06af to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<a class="circle-button">foo</a>
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
@function luminance($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) + 0.0722 * nth($rgba2, 3))*100;
}
.foo {
bar: luminance(red);
}
.foo {
bar: 21.26;
}
<a class="circle-button">foo</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment