Skip to content

Instantly share code, notes, and snippets.

@ahaywood
Created March 23, 2017 15:53
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 ahaywood/5ae61142b34791cab491bbd7fe7b98a3 to your computer and use it in GitHub Desktop.
Save ahaywood/5ae61142b34791cab491bbd7fe7b98a3 to your computer and use it in GitHub Desktop.
Creating a color scheme
// Scheme of colors
$colorscheme: (
  gray: (
    base: #ccc,
    light: #f2f2f2,
    dark: #666
  ),
  brown: (
    base: #ab906b,
    light: #ecdac3,
    dark: #5e421c
  )
);
// Our function for shorter usage of map-get();
@function setcolor($scheme, $tone: base) {
    @return map-get(map-get($colorscheme, $scheme), $tone);
}
.element {
  color: setcolor(brown);
}
.element--light {
  color: setcolor(brown, light);
}
.element {
    color: #ab906b;
}
.element--light {
    color: #ecdac3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment