Apply conditionnal color on icon/text on FORM

To apply a specific color on text/color in a form like this :

image

You will have to use the Cell class attribute of your column :

Use a Javascript expression to choose which CSS class has to be applied :

For example this ternary function :
row.__modif_user_login == ‘administrateur’ ? ‘green-cell’ : ‘red-cell’

It means : if the user is administrateur, it will apply green-cell, else it will apply red-cell.

You can also compute the correct CSS class in the database (in the model), and just for each line choose row.my_css_class instead.

Then just compute your style in V1 custom form attribute :

<style>

.green-cell span { color : green }
.green-icon i { color : green !important }
.red-cell span { color : red }
.red-icon i { color : red !important }

</style>

Do not forget : on icon you have to add !important because style is overriden by default