Is it possible to save background colors in a list?

I’d like to know if it is possible to save background colors of certain buttons in a list. When I tried it, nothing showed up in the list. This is basically what I want to do:


However, no background color appears on any of the other buttons. Surprisingly, when I try this:

and I try to display the code (the random colour function just retrieves a random item from the all colors list), I see each button with the corresponding item of the list as the background color. This happens even though I’m creating the all colors list out of background colors. Why is the variable code working and the variable color clicked list not working?
Thanks, I hope I made any sense!

1 Like

Yes, I’ve been able to store and retrieve background colors using lists.

2 Likes

I just tested the use of background color in relation to the WDC and it works.

1 Like

Thank you! Surprisingly, I tried after a day and now it works.

1 Like

And it’s not working again (the buttons don’t have changed background colors).
This is what I’m doing:

1 Like

… try to put some:
repeat while i<4
wait 0.001 after count…
and a wait 0.001 inside count

that will give time to loop until is done.

2 Likes

Thanks, let me try that!

Nope, I still don’t see the colors.

1 Like

If you provide me the problem you want to achieve (and not blocks, but what is your action and what do you expect to get), ill think about it :thinking: (sometimes is easier to think some issue from the scratch, than trying to correct other`s code :relaxed:)

1 Like

this is only to check if you can save colors to a list :relaxed:
https://x.thunkable.com/copy/d0d1d5a7a39245025d126a9824dac672

1 Like

Are you using DnD?
If yes, then I am facing the same thing. The issue is not consistent. It works and some times it doesn’t.

1 Like

Thank you @mimostel , but when I try that I don’t get the background colors in the buttons. I’m trying to use the background colors of some buttons after saving them in a list, but I realised that the list seemed empty even after running the code to save the colours. So, to test whether the list is actually populated, I need to display the contents using buttons was the only way I could think of.

I’m using StP, for the rows, columns, and cloning (I’m working on my Mastermind app).

1 Like

Haha, @muneer already showed his app… go for it and “steal” his ideeas :rofl:

1 Like

Haha, let me go and check out the code.

I always use “alert” block to display at a point something.

1 Like

But how can I display colors using an alert?

If you put set alert message = background color, will get something in like rgba(x,x,x,x)

1 Like

Oh, I didn’t know that! Let me try that.

I finally realised the issue! I’ve been setting the variable color clicked list to empty before doing the check function and other functions! I’ve shifted it to the end, and now everything works! Thank you so much for your help!

2 Likes