Is it possible to reference variables based on the value of another variable? This functionality exists in languages like PHP.
For example, in Sass:
I have variables $green, $blue, and $yellow being included from a partial. I want to dynamically set the border-color using these variables while looping through a list of color names:
$colors = green, yellow, blue;
@each $c in $colors {
&.#{$c} {
border-color: $#{$c};
}
}
The above code should ideally generate classes for .green, .yellow, and .blue with corresponding border-color properties. However, this code does not work as intended. Are there alternative methods to achieve this in Sass/Compass?