Template Sensor State Icon Color Change

Hi can anyone assist trying to add a state color change to custom template

In my configuration.yaml

template:
  - sensor:
      - name: "Driveway Motion"
        state: "{{state_attr('camera.driveway_camera', 'detected' )}}"
        icon: mdi:motion-sensor

Possible states is true or false

Any help would be awsome thx all