dotfiles

config files for my linux setup
git clone git://edryd.org/dotfiles
Log | Files | Refs | README

_functions.scss (2007B)


      1 $modules: () !default;
      2 
      3 @mixin exports($name) {
      4     @if (not index($modules, $name)) {
      5         $modules: append($modules, $name) !global;
      6 
      7         @content;
      8     }
      9 }
     10 
     11 @function alpha($color, $amount) {
     12     @if type-of($color) == "color" {
     13         @return fade-out($color, (1 - $amount));
     14     } @else {
     15         @return unquote("alpha(#{$color},#{$amount})");
     16     }
     17 }
     18 
     19 @function shade($color, $amount) {
     20     @if type-of($color) == "color" {
     21         @if ($amount > 1) {
     22             @return lighten($color, ($amount - 1) * lightness($color))
     23         } @else {
     24             @return darken($color, (1 - $amount) * lightness($color))
     25         }
     26     } @else {
     27         @return unquote("shade(#{$color},#{$amount})");
     28     }
     29 }
     30 
     31 @function mix($color1, $color2, $amount) {
     32     @return unquote("mix(#{$color1},#{$color2},#{$amount})");
     33 }
     34 
     35 @function border_normal($color) {
     36     @return shade($color, $contrast);
     37 }
     38 
     39 @function border_focus($color) {
     40     @return shade($color, ($contrast - .05));
     41 }
     42 
     43 @function border_active($color) {
     44     @return shade($color, ($contrast - .1));
     45 }
     46 
     47 @function border_insensitive($color) {
     48     @return shade($color, ($contrast + .05));
     49 }
     50 
     51 @mixin linear-gradient($color, $direction: to bottom) {
     52     @if $gradient == 0 {
     53         background-color: $color;
     54         background-image: none;
     55     } @else {
     56         $amount: $gradient / 2;
     57 
     58         background-color: $color;
     59         background-image: linear-gradient($direction,
     60             shade($color, (1 + $amount)),
     61             shade($color, (1 - $amount))
     62         );
     63     }
     64 }
     65 
     66 @mixin border($color) {
     67     border-color: border_normal($color);
     68 
     69     &:focus, &:hover { border-color: border_focus($color); }
     70 
     71     &:active, &:active:hover,
     72     &:active:focus, &:active:hover:focus,
     73     &:checked, &:checked:hover,
     74     &:checked:focus, &:checked:hover:focus { border-color: border_active($color); }
     75 
     76     &:insensitive { border-color: border_insensitive($color); }
     77 
     78     &:active:insensitive, &:checked:insensitive { border-color: border_normal($color); }
     79 }