In SASS, there are variables, but you cannot pass variables into it from
the app.  The variables in SASS are compiled down to CSS as hardcoded
values, that's it.

Usually, multiple class values are created and we set the class property on
an element using a string evaluation.

For example:

var colorName = this.hasWarning() ? "Red" : "Blue";
var className:String = "button" + colorName + "Class";

element.setAttribute("class", className);

In the css:

.buttonRedClass {
    color: darkred;

.buttonBlueClass {
    color: lightskyblue;

This is one way of doing things.

The other way is to directly set the .style property of the element and
apply the color there.  Not very elegant, but should work.

Hope that helps.


On Wed, Mar 7, 2018 at 3:18 PM, Carlos Rovira <>

> Hi,
> I'd need to pass two or three colors to a CSS (i.e: primary, secondary and
> accent)
> in other frameworks people use things like SASS
> Maybe in Royale we could get it in our own way
> any suggestion so that I could test?
> thanks!
> --
> Carlos Rovira

Reply via email to