Last active
August 29, 2015 14:08
-
-
Save MagicJoseph/ede612e801af4c4a96c8 to your computer and use it in GitHub Desktop.
Sass colorful stripe generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Stripe</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<div class="stripe-container"> | |
<div class="stripe emerald"></div> | |
<div class="stripe peter-blue"></div> | |
<div class="stripe amethyst"></div> | |
<div class="stripe sun"></div> | |
<div class="stripe carrot"></div> | |
<div class="stripe alizarin"></div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.6) | |
// Compass (v1.0.1) | |
// ---- | |
// Color variables | |
$emerald: #2ecc71 !default; | |
$peter-blue: #3498db !default; | |
$amethyst: #9b59b6 !default; | |
$sun: #f1c40f !default; | |
$carrot: #e67e22 !default; | |
$alizarin: #e74c3c !default; | |
$color-map: | |
$emerald, | |
$peter-blue, | |
$amethyst, | |
$sun, | |
$carrot, | |
$alizarin; | |
$color-clases: | |
emerald, | |
peter-blue, | |
amethyst, | |
sun, | |
carrot, | |
alizarin; | |
// Stripe variables | |
$stripe-container-display: block !default; | |
$stripe-container-width: 100% !default; | |
$stripe-container-height: auto !default; | |
$stripe-display: block !default; | |
$stripe-width: (100%/(length($color-map))) !default; | |
$stripe-height: 10px !default; | |
$stripe-default-float: left; | |
@mixin clearfix { | |
&:before, &:after { | |
content: ""; | |
display: table; | |
} | |
&:after { | |
clear: both; | |
} | |
} | |
@mixin stripe-container-base { | |
width: $stripe-container-width; | |
height: $stripe-container-height; | |
} | |
@mixin stripe-base { | |
display: $stripe-display; | |
width: $stripe-width; | |
height: $stripe-height; | |
float: $stripe-default-float; | |
} | |
@mixin stripe-classes { | |
@for $i from 1 through length($color-map) { | |
&.#{nth($color-clases, $i)} { | |
background-color: nth($color-map,$i); | |
} | |
} | |
} | |
@mixin stripe { | |
@include stripe-base; | |
@include stripe-classes; | |
} | |
.stripe-container { | |
@include clearfix; | |
@include stripe-container-base; | |
} | |
.stripe { | |
@include stripe; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.stripe-container { | |
width: 100%; | |
height: auto; } | |
.stripe-container:before, .stripe-container:after { | |
content: ""; | |
display: table; } | |
.stripe-container:after { | |
clear: both; } | |
.stripe { | |
display: block; | |
width: 16.66667%; | |
height: 10px; | |
float: left; } | |
.stripe.emerald { | |
background-color: #2ecc71; } | |
.stripe.peter-blue { | |
background-color: #3498db; } | |
.stripe.amethyst { | |
background-color: #9b59b6; } | |
.stripe.sun { | |
background-color: #f1c40f; } | |
.stripe.carrot { | |
background-color: #e67e22; } | |
.stripe.alizarin { | |
background-color: #e74c3c; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment