How To Auto Change Text Color

How can I change negative (-) amounts to a red color that’s based on a dynamic list? This list is a downloaded CSV file that is imported to a database. Some of the amounts have minuses (-) in front of the amount, i.e. -400.99, etc.

Since they are mixed in the output from the CSV, I would like the negative currency to be red.

Is something like this a correct usage:

dmx-style:text-danger.important=“amount.startsWith(”-")"

You want to use the toggle class based on value <. 0. You will find it in the dynamic attributes

Hey Brad! Are you referring to the class toggle? And then just set up the condition? I’ll give it a try. So far everything I’ve tried has been a fail. Ha!

Yes exactly.

That did it!
class=“text-right w-auto” dmx-class:text-danger.important=“amount.startsWith(’-’)”

Thank you!

Glad it worked out for you!

Can you add multiple classes inside the dmx-class? Like add a bold to the danger, etc.

I’m far from a css guru but you should be able to add any class that you have linked to your page.

It appears that you can only have one dmx-class: ? = whatever. The previous class=“text-right w-auto text-bold” worked.

You should be able to add as many class toggles as you wish. You will need to add one for each class.