Last active
June 16, 2016 06:46
-
-
Save yllieth/375e23e02bc505b26e1897ac73b9ec0b to your computer and use it in GitHub Desktop.
Foudation utility 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
// A row with fixed height, background-color and text-color. Useful to create topbars of footers | |
@mixin banner($bg: $body-background, $color: $body-font-color, $height: $banner-height) { | |
height: $height; | |
line-height: $height; | |
background-color: $bg; | |
color: $color; | |
}; | |
// Fine positionning mixin. Useful to align rebellious elements | |
@mixin offset($size, $origin: top) { | |
position: relative; | |
#{$origin}: $size; | |
} | |
// Add an animation when mouse hovers an element | |
@mixin hover-transition($property, $value, $duration: 150ms, $transition: ease-in-out) { | |
transition: $property $duration $transition; | |
&:hover { | |
#{$property}: $value; | |
} | |
} | |
// Create a squared container | |
@mixin square($size) { | |
display: inline-block; | |
width: $size; | |
height: $size; | |
} |
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
$banner-height: 50px; | |
$global-spacing: 20px; | |
$foundation-palette: ( | |
primary: #2199e8, | |
secondary: #777, | |
success: #3adb76, | |
warning: #ffae00, | |
alert: #ec5840, | |
); | |
$light-gray: #e6e6e6; | |
$medium-gray: #cacaca; | |
$dark-gray: #8a8a8a; | |
$black: #0a0a0a; | |
$white: #fefefe; | |
$body-background: $white; | |
$body-font-color: $black; | |
$border-color: $medium-grey; |
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
// spacing | |
@each $property in (margin, padding) { | |
.#{$property} { #{$property}: $global-spacing; } | |
@each $position in (top, right, bottom, left) { | |
.no-#{$property} { #{$property}: 0 !important;} | |
.no-#{$property}-#{$position} { #{$property}-#{$position}: 0 !important;} | |
.#{$property}-#{$position} { #{$property}-#{$position}: $global-spacing !important;} | |
.#{$property}-#{$position}-double { #{$property}-#{$position}: $global-spacing * 2 !important;} | |
.#{$property}-#{$position}-half { #{$property}-#{$position}: $global-spacing / 2 !important;} | |
.border-#{$position} { border-#{$position}: 1px solid $border-color; } | |
.no-border-#{$position} { border-#{$position}: none; } | |
} | |
} | |
.margin-vertical { margin-top: $global-spacing !important; margin-bottom: $global-spacing !important; } | |
.margin-vertical-half { margin-top: $global-spacing/2 !important; margin-bottom: $global-spacing/2 !important; } | |
.margin-vertical-double { margin-top: $global-spacing*2 !important; margin-bottom: $global-spacing*2 !important; } | |
.margin-horizontal { margin-left: $global-spacing !important; margin-right: $global-spacing !important; } | |
.margin-horizontal-half { margin-left: $global-spacing/2 !important; margin-right: $global-spacing/2 !important; } | |
.margin-horizontal-double { margin-left: $global-spacing*2 !important; margin-right: $global-spacing*2 !important; } | |
// cursors | |
@each $cursorType in (pointer, help, wait) { | |
.cursor-#{$cursorType} { cursor: #{$cursorType}; } | |
} | |
// colors | |
@each $name, $color in $foundation-palette { | |
.color-#{$name} { color: $color; } | |
.color-#{$name}-hover { @include hover-transition(color, $color); } | |
.bg-#{$name} { background-color: $color; } | |
.bg-#{$name}-hover { @include hover-transition(background-color, $color); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
utility.scss
generator will create the following classes: