Skip to content

Instantly share code, notes, and snippets.

@onebytegone
Created April 23, 2015 15:23
Show Gist options
  • Save onebytegone/e24de8a96e9f13711e42 to your computer and use it in GitHub Desktop.
Save onebytegone/e24de8a96e9f13711e42 to your computer and use it in GitHub Desktop.
SCSS to control state colors
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
@mixin stateColor($normal, $hover:"") {
background-color: $normal;
@if $hover != '' {
&:hover {
background-color: $hover;
}
}
}
.hover {
@include stateColor(#fff, #000);
}
.normal {
@include stateColor(#fff);
}
.hover {
background-color: #fff;
}
.hover:hover {
background-color: #000;
}
.normal {
background-color: #fff;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment