I am new to using CSS pre-compilers and started using Less. I found Sass code to add themes to my web app and it works great.
https://codepen.io/dmitriy_borodiy/pen/RKzwJp
I am trying to convert it to Less and having difficulty rewriting it. I have gone through Less documentation but sorry to say that I am not even able to create a multilevel themes variable.
sass variable is as follows:
$themes: (
light: (
backgroundColor: white,
textColor: #408bbd
),
dark: (
backgroundColor: #222,
textColor: #ddd
),
);
Below conversion is totally wrong but this is what I have tried:
@set: {
light: {
backgroundColor: white,
textColor: #408bbd
},
dark: {
backgroundColor: #222,
textColor: #ddd
},
}
EDIT:
Example of what I am trying to achieve:
.theme(key) {
return all outcomes using @themes variable.
}
div {
background: .theme(divBackgroundColor)
}
it should return the following css :
.light-theme div{
background: white
}
.dark-theme div{
background:grey
}
Any help is appreciated.