// Author: Valeriu Tihai //FUNCTION //Convert PT to EM @function pt2em($size){ @return #{$size * 0.0836458341698}em //@return #{$pixel / $base-size}em; } //MIXIN @mixin opacity($value) { $opacity-ie: $value * 100; opacity: $value; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity="$opacity-ie")"; filter: alpha(opacity= $opacity-ie ); zoom: 1; } @mixin hardware-acceleration { @include transform(translateZ(0)); @include backface-visibility(hidden); @include perspective(1000); } @mixin grayscale($pct) { -webkit-filter: grayscale($pct); /* Chrome 19+, Safari 6+, Safari 6+ iOS */ -moz-filter: grayscale($pct); -o-filter: grayscale($pct); -ms-filter: grayscale($pct); filter: url("data:image/svg+xml;utf8,#grayscale"); /* Firefox 10+, Firefox on Android */ filter: gray; /* IE6-9 */ filter: grayscale($pct); } @mixin blur($blur) { -webkit-filter: blur($blur); -moz-filter: blur($blur); -o-filter: blur($blur); -ms-filter: blur($blur); filter: blur($blur); } @mixin gradient($from, $to) { background-color: $from; background: -webkit-gradient(linear, left top, left bottom, from($from), to($to)); background: -o-linear-gradient(top, $from, $to); background: -moz-linear-gradient(top, $from, $to); background: -ms-linear-gradient(top, $from, $to); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}', GradientType=0 ); } @mixin box-shadow($top, $left, $blur, $spread, $color, $inset: false) { @if $inset { -webkit-box-shadow:inset $top $left $blur $spread $color; -moz-box-shadow:inset $top $left $blur $spread $color; box-shadow:inset $top $left $blur $spread $color; } @else { -webkit-box-shadow: $top $left $blur $spread $color; -moz-box-shadow: $top $left $blur $spread $color; box-shadow: $top $left $blur $spread $color; } } @mixin border-radius($radius: 5px) { -webkit-background-clip: padding-box; -webkit-border-radius: $radius; -moz-background-clip: padding-box; -moz-border-radius: $radius; border-radius: $radius; background-clip: padding-box; } @mixin ribbon($color, $textcolor : #ffffff, $bleed : 1px){ font-weight: bold; font-family: Sans-Serif; color: #333; font-size: 12px; text-transform: uppercase; text-align: center; transform: rotate(45deg); position: relative; padding: 6px 0; left: 4px; top: 20px; width: 155px; box-shadow: 0px 0px 3px 2px rgba(0,0,0,0.1); background: -webkit-gradient(linear, left top, left bottom, from(lighten($color,10%)), to($color)); color: $textcolor; &:before, &:after { content: ""; /* Colour of the triangle. To flip the effect, use border-bottom. */ border-top: $bleed solid $color; border-left: $bleed solid transparent; border-right: $bleed solid transparent; position:absolute; bottom: -$bleed; /* +1 to compensate for the border */ } &:before { left: 0; } &:after { right: 0; } } // for debug only, ex: @include debug(green); */ @mixin debug($color) { outline:1px solid $color; } // links color @mixin link-colors($normal, $hover: false, $active: false, $visited: false, $focus: false, $normalbg: false, $hoverbg: false) { color: $normal; @if $normalbg { background-color: $normalbg; } @if $hoverbg { &:hover { background-color: $hoverbg; } } @if $visited { &:visited { color: $visited; } } @else { &:visited { color: lighten($normal, 10%); } } @if $focus { &:focus { color: $focus; } } @if $hover { &:hover { color: $hover; } } @else { &:hover { color: darken($normal, 10%); } } @if $active { &:active { color: $active; } } } // Transperent Background @mixin transparent-bg($color, $alpha) { $rgba: rgba($color, $alpha); $ie-hex-str: ie-hex-str($rgba); background-color: transparent; background-color: $rgba; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#{$ie-hex-str},endColorstr=#{$ie-hex-str}); zoom: 1; }