I am restructuring the whole sass setup for a client, and for the purpose of their color palette I have created a map with contains the palette. For the sake of the client I have inserted some fake color values in this question.
$foundation-palette: (
primary: (
blue: (
base: rgba(155, 177, 255, 1),
light: rgba(155, 177, 255, 75%),
lighter: rgba(155, 177, 255, 50%),
lightere: rgba(155, 177, 255, 25%),
lightest: rgba(155, 177, 255, 15%),
),
beige: (
base: rgba(255, 233, 155, 1),
light: rgba(255, 233, 155, 75%),
lighter: rgba(255, 233, 155, 50%),
lightere: rgba(255, 233, 155, 25%),
lightest: rgba(255, 233, 155, 15%),
),
),
secondary: (
base: rgba(233, 151, 144, 1),
light: rgba(233, 151, 144, 80%),
),
tertiary: (
green: (
base: rgba(109, 192, 102, 1),
light: rgba(109, 192, 102, 75%),
lighter: rgba(109, 192, 102, 50%),
lightere: rgba(109, 192, 102, 25%),
lightest: rgba(109, 192, 102, 15%),
),
....
),
white: #fff
);
The issue is, that the color palette contains a number of colors which all have different shades defined with an opacity value.
With the current setup, the opacity values doesn't get registered, meaning that when I try to use the primary-blue-lightest color it will just be compiled into the base color of that (no opacity value).
However, I am wandering if I should even declare the color palette with opacity values. Even though it is in the design principles of the client, I wonder how good a practice this is in your sass setup. For example if I want a light grey color, it would be an opaque version of black.
Depending on this I either want to declare the colors without opacity, But how do I find the correct color value of the rgb value with will match with the opaque version?
If it is fine to use opacity in your color palette, I am wandering why the 'lightest' value for example compiles into the base color. What is the guideline here ? and how should I go about this ?
Any input is appreciated
EDIT: I am accessing the colors by doing a map-get:
$primary-blue-lightest: map-get(map-get(map-get($foundation-palette, primary), blue), lightest);
Another simple approach could be to create a function
and pass the base color and the opacity as argument:
@function colorPalette($RGBColor, $opacityLevel) {
@return rgba($RGBColor, $opacityLevel);
}
Then you can create a variable off of this function:
$green: colorPalette(rgb(0,255,0), .9);
And use it:
.section { background-color: $green; }