When this answer is not what you were looking for, please tell us exactly what you want to archieve and maybe somebody can give you a more accurate answer.
You can create a record list with the user defined color and create a web block that uses the record to format the container.
Then you put the we block inside a list structure and refresh the list after the user input is changed.
That will only change colors accordingly but it will not increase or decrease the amount of containers
Can you make a sketch of what you need, because I believe that by using a recordlist with multiple records you should be able to have more or less records, which equals the increase or decrease of the number of containers.
However, I doubt you need that because you have no control anymore.
For example, using a local list on the server and use it with ListRecords and add/remove them via ajax will help you to achieve the same incldsuing full control and knowledge about what you want to achieve,.
Or even simpler, the editable-table is a perfect example for it.
Using a ListRecord or EditableTable requires data in the database. the amount of containers is given by the user on runtime. for example I want to present the user with an empty page and an input where he enters a number and depending on the amount he enters a table with the same amount of rows/cols is displayed.
Here is an example.