Skip to content

Instantly share code, notes, and snippets.

@davidpollet
Created October 12, 2017 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidpollet/e8ea2b8c7eb7e348a079f40c17a9a176 to your computer and use it in GitHub Desktop.
Save davidpollet/e8ea2b8c7eb7e348a079f40c17a9a176 to your computer and use it in GitHub Desktop.
Sass Mixin - Tinted background generator
// Generate a color or gradient filter above an image
// Codepen demo : https://codepen.io/davidpollet/pen/mAVyOG
@mixin bg-tinted(
$img-url,
$tint-1:#000,
$tint-opacity-1:0.8,
$tint-2: $tint-1,
$tint-opacity-2:$tint-opacity-1,
$direction: to bottom,
$position:center center,
$repeat: no-repeat
) {
background: linear-gradient(
$direction,
rgba($tint-1, $tint-opacity-1),
rgba($tint-2, $tint-opacity-2)),
url('#{$img-url}') $repeat $position;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment