Correct! But it can be simplified (note that this is also a spoiler for the hard version):
Sbe rnpu rdhvinyrapr pynff cvpx n ercerfragngvir zrzore. Gura unir rirelbar thrff nf vs gurl jrer va gung frdhrapr. V guvax guvf jbexf sbe neovgenel pneqvanyvgvrf bs cevfbaref naq pbybhef.
EDIT: I remembered to ROT13 it.
This was my solution, and it does work for arbitrary cardinalities of colors and prisoners, as long as you're okay with the prisoners remembering arbitrary amounts of information. :)
Even harder version, to which this problem was a hint (and which I haven't solved yet, so please continue to ROT13 solutions):
There are countably many boxes 1,2,3,..., into each of which Alice places an arbitrary real number. Bob then opens finitely many boxes, looking at the real numbers they contain as he goes, and then names a single real number and opens a single unopened b...
If it's worth saying, but not worth its own post (even in Discussion), then it goes here.