Error when defining a color; unknown named color

Hello. I am receiving the below error message when I try to run my study online.
I have 4 stimuli parts that create a circle. For each task I randomly assign two colors to each stimulus part, then depending on the value in my condition file (0 or 1), the part changes color.

To do this, I have a list of my colors. I shuffle the list each time a new task starts. I have variables $Slice1Color, $Slice2Color, $Slice3Color, $Slice4Color, in the image foreground color spot.
I have code that assigns the colors to the variables (below the error message) depending on what the value in the condition file is. This works well in the builder, but when I try to run online I receive the error message. Any advice would be greatly appreciated.

This code is in the Begin Routine tab of my second routine. I have also tried moving it to the first routine but that did not make a difference.

if Slice1 == 0:
    Slice1Color = ColorChoices[0]
    S1.append(Slice1Color)
if Slice1 == 1:
    Slice1Color = ColorChoices[1]
    S1.append(Slice1Color)
if Slice2 == 0:
    Slice2Color = ColorChoices[2]
    S2.append(Slice2Color)
if Slice2 == 1:
    Slice2Color = ColorChoices[3]
    S2.append(Slice2Color)
if Slice3 == 0:
    Slice3Color = ColorChoices[4]
    S3.append(Slice3Color)
if Slice3 == 1:
    Slice3Color = ColorChoices[5]
    S3.append(Slice3Color)
if Slice4 == 0:
    Slice4Color = ColorChoices[6]
    S4.append(Slice4Color)
if Slice4 == 1:
    Slice4Color = ColorChoices[7]
    S4.append(Slice4Color)

Example of a condition file where it’s reading the color values from:
image

I think the problem may be your if statements. Try using else instead of if a=1 followed by if a=0. You may find that all the else conditions are activated, which would show that the colours work and you should check your values.

I made a few changes and am no longer getting the error message. However, my colors are still not translating. The first image is what I am seeing now online, and the second image is what I’m seeing in the builder (which is correct).

I also changed my second if statements to else statements and it is the same.

***Edit

To test the code I have, I changed it to the code below, and it still shows only as white online. I’ve tried also changing it from an integer 0 to ‘0’ and from 0 to 1 and it has not made a difference. The Slice# variables in my condition sheet, and I know it’s reading the condition sheet because it is still giving me feedback based on the information in the condition sheet.

I’m not sure what else I should check.

if Slice1 == 0:
    Slice1Color = 'red'
    S1.append(Slice1Color)
else:
    Slice1Color = 'blue'
    S1.append(Slice1Color)
if Slice2 == 0:
    Slice2Color = 'red'
    S2.append(Slice2Color)
else:
    Slice2Color = 'blue'
    S2.append(Slice2Color)
if Slice3 == 0:
    Slice3Color = 'red'
    S3.append(Slice3Color)
else:
    Slice3Color = 'blue'
    S3.append(Slice3Color)
if Slice4 == 0:
    Slice4Color = 'red'
    S4.append(Slice4Color)
else:
    Slice4Color = 'blue'
    S4.append(Slice4Color)

To test further, in the image component I took out the variable Slice#Color, and replaced it with red. I still get just white images when running online. But if I click the specify color button and select a color and it autofills with RGB values (I chose red), the color appears online (however it’s actually showing grey not red). I’m still not sure how to fix this, but it seems part of the issue is that when it is using the color names it is not changing the color.