fix rules
encode the state into the "r" component instead of raw color