[SOLVED]/Improving Color Loop

This script works great for me. Is there a way of doing more of a flicker as well, where you can actually see the colours (like red, blue, green etc as some of my lights do on startup)

I did have to remove the top part and fill in the entity hardcoded, i guess i’m missing some critical yaml or indentation.

rainbow_light: # had to remove this (it's not indented now but it was before)
alias: rainbow light
mode: single
fields:
  entity:
    description: The entity that will be rainbowed
    example: light.study_room_light_1
variables:
  colors: |-
    {{ [[0.217,0.077], [0.157,0.05], [0.136,0.04], [0.137,0.065],
        [0.141,0.137], [0.146,0.238], [0.151,0.343], [0.157,0.457],
        [0.164,0.591], [0.17,0.703], [0.172,0.747], [0.199,0.724],
        [0.269,0.665], [0.36,0.588], [0.444,0.517], [0.527,0.447],
        [0.612,0.374], [0.677,0.319], [0.701,0.299], [0.667,0.284],
        [0.581,0.245], [0.477,0.196], [0.385,0.155], [0.301,0.116], 
        [0.217,0.077]] }}
sequence:
  - service: light.turn_on
    data_template:
      xy_color: |
        {{  colors[(now().second/2.5)|round(0)] }}
      transition: 1
      entity_id: light.study_room_light_1 #'{{ entity }}'

@tom_l is there a way to alter the brightness? I’ve put in a brightness: 10 or brightness_pct:10 but each colour change momentarily sets the brightness to 100% and then down to 10, so it’s a flicker when doing the transition.

Also tried adding the brightness in the automation data but no joy.