Skip to content

Instantly share code, notes, and snippets.

@Kcko
Last active August 29, 2015 14:10
Show Gist options
  • Save Kcko/ac042b3c32eb191e2a0d to your computer and use it in GitHub Desktop.
Save Kcko/ac042b3c32eb191e2a0d to your computer and use it in GitHub Desktop.
Hračka - ukázka theme - vygenerování struktury
<section class="theme-green">
<div class="a">A</div>
<div class="b">B</div>
</section>
<section class="theme-red">
<div class="a">A</div>
<div class="b">B</div>
</section>
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
@mixin theme ($theme: 'green', $map: ())
{
div.a
{
color: map-get($map, colorPrimary);
border: 1px solid;
padding: 5px;
}
div.b
{
color: map-get($map, colorSecondary);
border: 1px solid;
padding: 5px;
background: lighten(map-get($map, colorSecondary), 20);
}
}
.theme-green
{
@include theme('green', (colorPrimary: green, colorSecondary: #80ff00));
}
.theme-red
{
@include theme('red', (colorPrimary: red, colorSecondary: #bf0000));
}
.theme-green div.a {
color: green;
border: 1px solid;
padding: 5px;
}
.theme-green div.b {
color: #80ff00;
border: 1px solid;
padding: 5px;
background: #b3ff66;
}
.theme-red div.a {
color: red;
border: 1px solid;
padding: 5px;
}
.theme-red div.b {
color: #bf0000;
border: 1px solid;
padding: 5px;
background: #ff2626;
}
<section class="theme-green">
<div class="a">A</div>
<div class="b">B</div>
</section>
<section class="theme-red">
<div class="a">A</div>
<div class="b">B</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment