Last active
March 23, 2021 00:56
-
-
Save noelspringer/2be604ead6c411ceb165c78094bc83ea to your computer and use it in GitHub Desktop.
Sass functions for color tints and shades
This file contains hidden or 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
| // _colors.scss | |
| // Reference: https://css-tricks.com/snippets/sass/tint-shade-functions/ | |
| // Slightly lighten a color | |
| // | |
| // @access public | |
| // @param {Color} $color - color to tint | |
| // @param {Number} $percentage - percentage of `$color` in returned color | |
| // @return {Color} | |
| @function tint($color, $percentage) { | |
| @return mix(rgb(255,255,255), $color, $percentage); | |
| } | |
| // Slightly darken a color | |
| // | |
| // @access public | |
| // @param {Color} $color - color to shade | |
| // @param {Number} $percentage - percentage of `$color` in returned color | |
| // @return {Color} | |
| @function shade($color, $percentage) { | |
| @return mix(rgb(0, 0, 0), $color, $percentage); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment