Created
March 12, 2012 17:48
-
-
Save mirisuzanne/2023622 to your computer and use it in GitHub Desktop.
Tint and Shade for Compass
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
// Tint and Shade for Compass ------------------------------------------------ | |
@function tint($color, $dilution: 50) { | |
$white: rgba(255, 255, 255, 1); | |
@if $color == "transparent" { | |
$color: rgba(0, 0, 0, 0); } | |
@if $dilution < 0 or $dilution > 100 { | |
@warn "Dilution #{$dilution} must be between 0 and 100"; } | |
$tint-color: mix($color, $white, 100 - $dilution); | |
@return $tint-color; } | |
@function shade($color, $dilution: 50) { | |
$black: rgba(0, 0, 0, 1); | |
@if $color == "transparent" { | |
$color: rgba(0, 0, 0, 0); } | |
@if $dilution < 0 or $dilution > 100 { | |
@warn "Dilution #{$dilution} must be between 0 and 100"; } | |
$shade-color: mix($color, $black, 100 - $dilution); | |
@return $shade-color; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment