@mixin button ($style: simple, $base-color: #4294f0) { @if type-of($style) == color { $base-color: $style; $style: simple; } @if $style == simple { @include simple($base-color); } @else if $style == shiny { @include shiny($base-color); } @else if $style == pill { @include pill($base-color); } } @mixin simple ($base-color) { $stop-gradient: adjust-color($base-color, $saturation: 9%, $lightness: -11%); $border: adjust-color($base-color, $saturation: 9%, $lightness: -14%); $color: hsl(0, 0, 100%); $inset-shadow: adjust-color($base-color, $saturation: -8%, $lightness: 15%); $text-shadow: adjust-color($base-color, $saturation: 15%, $lightness: -18%); @if lightness($base-color) > 70% { $color: hsl(0, 0, 20%); $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); } border: 1px solid $border; @include border-radius (3px); @include box-shadow (inset 0 1px 0 0 $inset-shadow); color: $color; display: inline; font: bold 11px 'lucida grande', helvetica neue, helvetica, arial, sans-serif; @include linear-gradient ($base-color, $stop-gradient); padding: 6px 18px 7px; text-shadow: 0 1px 0 $text-shadow; -webkit-background-clip: padding-box; &:hover { $base-color-hover: adjust-color($base-color, $saturation: -4%, $lightness: -5%); $stop-gradient-hover: adjust-color($base-color, $saturation: 8%, $lightness: -14%); $inset-shadow-hover: adjust-color($base-color, $saturation: -7%, $lightness: 5%); @include box-shadow (inset 0 1px 0 0 $inset-shadow-hover); cursor: pointer; @include linear-gradient ($base-color-hover, $stop-gradient-hover); } &:active { $border-active: adjust-color($base-color, $saturation: 9%, $lightness: -14%); $inset-shadow-active: adjust-color($base-color, $saturation: 7%, $lightness: -17%); border: 1px solid $border-active; @include box-shadow (inset 0 0 8px 4px $inset-shadow-active, inset 0 0 8px 4px $inset-shadow-active, 0 1px 1px 0 #eee); } } @mixin shiny($base-color) { $second-stop: adjust-color($base-color, $saturation: 0%, $lightness: -15%); $third-stop: adjust-color($base-color, $saturation: 5%, $lightness: -22%); $fourth-stop: adjust-color($base-color, $saturation: 0%, $lightness: -19%); $border-top: adjust-color($base-color, $saturation: 0%, $lightness: -23%); $border-sides: adjust-color($base-color, $saturation: 0%, $lightness: -29%); $border-bottom: adjust-color($base-color, $saturation: 0%, $lightness: -35%); $color: hsl(0, 0, 100%); $inset-shadow: adjust-color($base-color, $hue: -5, $saturation: 23%, $lightness:-8%); $text-shadow: adjust-color($base-color, $saturation: 6%, $lightness: -21%); @if lightness($base-color) > 70% { $color: hsl(0, 0, 20%); $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); } @include linear-gradient (top, $base-color 0%, $second-stop 50%, $third-stop 50%, $fourth-stop 100%); border: 1px solid $border-top; border-color: $border-top $border-sides $border-bottom; @include border-radius (4px); @include box-shadow(inset 0 0 2px 0 $inset-shadow); color: $color; display: inline; font: bold 12px "helvetica neue", helvetica, arial, sans-serif; padding: 7px 18px; text-shadow: 0 -1px 1px $text-shadow; -webkit-background-clip: padding-box; &:hover { $first-stop-hover: adjust-color($base-color, $saturation: 2%, $lightness: -5%); $second-stop-hover: adjust-color($base-color, $saturation: 2%, $lightness: -18%); $third-stop-hover: adjust-color($base-color, $saturation: 23%, $lightness: -26%); $fourth-stop-hover: adjust-color($base-color, $saturation: 16%, $lightness: -23%); @include linear-gradient (top, $first-stop-hover 0%, $second-stop-hover 50%, $third-stop-hover 50%, $fourth-stop-hover 100%); cursor: pointer; } &:active { $border-top-active: adjust-color($base-color, $saturation: 1%, $lightness: -19%); $border-sides-active: adjust-color($base-color, $saturation: 1%, $lightness: -34%); $border-bottom-active: adjust-color($base-color, $saturation: 1%, $lightness: -40%); $inset-shadow-active: adjust-color($base-color, $saturation: -1%, $lightness: -33%); border: 1px solid $border-top-active; border-color: $border-top-active $border-sides-active $border-bottom-active; @include box-shadow(inset 0 0 5px 2px $inset-shadow-active, 0 1px 0 #eee); } } @mixin pill($base-color) { $stop-gradient: adjust-color($base-color, $hue: 8, $saturation: 14%, $lightness: -10%); $border-top: adjust-color($base-color, $hue: -1, $saturation: -30%, $lightness: -15%); $border-sides: adjust-color($base-color, $hue: 4, $saturation: -21%, $lightness: -21%); $border-bottom: adjust-color($base-color, $hue: 8, $saturation: -11%, $lightness: -26%); $color: hsl(0, 0, 100%); $inset-shadow: adjust-color($base-color, $hue: -1, $saturation: -1%, $lightness: 7%); $text-shadow: adjust-color($base-color, $hue: 5, $saturation: -19%, $lightness: -15%); @if lightness($base-color) > 70% { $color: hsl(0, 0, 20%); $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); } @include linear-gradient ($base-color, $stop-gradient); border: 1px solid $border-top; border-color: $border-top $border-sides $border-bottom; @include border-radius(16px); @include box-shadow(inset 0 1px 0 0 $inset-shadow, 0 1px 2px 0 #b3b3b3); color: $color; display: inline; font-family: "lucida grande", sans-serif; font-size: 11px; font-weight: normal; line-height: 1; padding: 3px 16px 5px; text-align: center; text-shadow: 0 -1px 1px $text-shadow; -webkit-background-clip: padding-box; &:hover { $base-color-hover: adjust-color($base-color, $lightness: -4.5%); $stop-gradient-hover: adjust-color($base-color, $hue: 8, $saturation: -4%, $lightness: -15.5%); $border-top: adjust-color($base-color, $hue: -1, $saturation: -17%, $lightness: -21%); $border-sides: adjust-color($base-color, $hue: 4, $saturation: -2%, $lightness: -27%); $border-bottom: adjust-color($base-color, $hue: 8, $saturation: 13.5%, $lightness: -32%); $inset-shadow-hover: adjust-color($base-color, $saturation: -1%, $lightness: 3%); $text-shadow-hover: adjust-color($base-color, $hue: 5, $saturation: -5%, $lightness: -22%); @include linear-gradient ($base-color-hover, $stop-gradient-hover); border: 1px solid $border-top; border-color: $border-top $border-sides $border-bottom; @include box-shadow(inset 0 1px 0 0 $inset-shadow-hover); cursor: pointer; text-shadow: 0 -1px 1px $text-shadow-hover; -webkit-background-clip: padding-box; } &:active { $active-color: adjust-color($base-color, $hue: 4, $saturation: -12%, $lightness: -10%); $border-active: adjust-color($base-color, $hue: 6, $saturation: -2.5%, $lightness: -30%); $border-bottom-active: adjust-color($base-color, $hue: 11, $saturation: 6%, $lightness: -31%); $inset-shadow-active: adjust-color($base-color, $hue: 9, $saturation: 2%, $lightness: -21.5%); $text-shadow-active: adjust-color($base-color, $hue: 5, $saturation: -12%, $lightness: -21.5%); background: $active-color; border: 1px solid $border-active; border-bottom: 1px solid $border-bottom-active; @include box-shadow(inset 0 0 6px 3px $inset-shadow-active, 0 1px 0 0 #fff); text-shadow: 0 -1px 1px $text-shadow-active; } }