I'm starting in SASS, and I have a problem that I can not solve.
I have a color group, 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 list of colors 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 class
"regions", the internal elements of that section
would pick up the colors of my cor-regioes
variable, such as a:hover
, span
etc.
I've tried it like this:
$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 the section, it takes as class, the color in HEXADECIMAL, and it does not work.
Can someone give me a light?