[SalesForce] How to define dynamically background color in Lightning

In Lightning is not possible to access CSS Style and modify css properties like background color. In my case I need to change CSS Background color style based on custom record field value.

I am interested in how to implement this on Lightning.

Best Answer

I think you should use inline css - somethink like this:

<aura:attribute type="String" name="colorBackground" default='blue'/> 
<div style="{! 'background-color:' + v.colorBackground }">
     <!-- code -->
</div>