1
I’m starting at SASS, and I’m having a little problem that I’m having trouble solving.
I have a group of colors, which will be used in several sessions of my site.
Basically, I have a structure like this:
<section id="lista-noticias" class="regioes">
<ul>
<li>
<a href="#">
<span class="data">SÁBADO, 17/05/2017, 20:07</span>
<h5 class="truncate">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nulla, quam dolore nemo itaque possimus? Dolore, doloribus corporis, voluptatibus, quasi necessitatibus hic quo quia rem, asperiores libero soluta. Eveniet, optio aspernatur.</h5>
</a>
</li>
</ul>
</section>
I have my color list like this:
$cor-regioes: #b71c1c;
$cor-esporte: #1b5e20;
$cor-saude: #f57f17;
$cor-arte: #0d47a1;
What I would like to "automate" is that when I put the class
"regions", the internal elements of that section
would take the colors of my variable cor-regioes
, like the a:hover
, span
, etc..
I tried so:
$cor-esporte: #1b5e20;
$cor-vida: #f57f17;
$cor-regioes: #b71c1c;
$cores: $cor-esporte, $cor-vida, $cor-regioes;
@mixin cor-elementos($cor) {
a:hover, span.data {
color: $cor
}
}
@each $cor in $cores {
section.#{$cor} {
@include cor-elementos($cor);
}
}
However, in Section, it takes as class, the color in HEXADECIMAL, and does not work.
Someone can give me a light?
Good... vlw by the tip.. I will test here too!
– D3rson