Skip to content

Instantly share code, notes, and snippets.

@noelspringer
Last active March 23, 2021 00:56
Show Gist options
  • Save noelspringer/2be604ead6c411ceb165c78094bc83ea to your computer and use it in GitHub Desktop.
Save noelspringer/2be604ead6c411ceb165c78094bc83ea to your computer and use it in GitHub Desktop.
Sass functions for color tints and shades
// _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