Changing color of an icon clicking on a row

I’d like to create a sort of "check " that change color (green / red) simply clicking on a row (or on the icon itself)

Which is the best way to do it ?

An action that toggles a value, and a format rule dependent on that value.