def _set_reward_colors(physics, reward):
  """Sets the highlight, effector and target colors according to the reward."""
  assert 0.0 <= reward <= 1.0

  colors = physics.named.model.mat_rgba

  def blend(color1, color2):
    return reward * colors[color1] + (1.0 - reward) * colors[color2]

  colors["self"] = blend("self_highlight", "self_default")
  colors["effector"] = blend("effector_highlight", "effector_default")
  colors["target"] = blend("target_highlight", "target_default")