Skip to content

Instantly share code, notes, and snippets.

@nheinrich
Created October 21, 2011 20:02
Show Gist options
  • Save nheinrich/1304802 to your computer and use it in GitHub Desktop.
Save nheinrich/1304802 to your computer and use it in GitHub Desktop.
Attempt at a background texture mixin for a project
// _colors.sass
$bg_blue: #6ec2d8
$bg_green: #6db933
$bg_orange: #ff5924
$bg_yellow: #e9f82e
// _mixins.sass
= textured($color)
background: eval("$bg_#{$color}") image_url("textures/#{$color}.png")
// note: this site uses four different background textures and they could all be built out with this mixin. Obviously this code is wrong but maybe it's close to get a pointer.
// currently produces:
// +textured("orange") => background: eval("$bg_orange") url('/images/textures/orange.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment