Skip to content

Instantly share code, notes, and snippets.

@liquorice
liquorice / gist:0c0a86e14c04694d9f30
Last active August 29, 2015 14:02
SASS keyframes mixin
@mixin animation($options...) {
$random: random(9999);
$animation_name: "animation_#{$random}";
-webkit-animation: $animation_name $options;
-moz-animation: $animation_name $options;
-ms-animation: $animation_name $options;
animation: $animation_name $options;
@at-root {
@liquorice
liquorice / gist:052294c8237f0b47b48e
Created August 11, 2014 06:55
Determine if a colour appears light or dark
var light_or_dark = function(hex) {
var rgb = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex),
luma = Math.sqrt(
0.299 * parseInt(rgb[1], 16) +
0.587 * parseInt(rgb[2], 16) +
0.144 * parseInt(rgb[3], 16)
);
return (luma > 13) ? "light" : "dark";
};