EDIT: May want to ignore this. This gives a total count of each item that can be used in a script later on, but doesn't actually address the OP's real question.
A somewhat more roundabout way to do this is to use the Summary platform and then read the resulting table into whatever script object you would like. I've used an associative array here.
// create temporary summary table
new = Data Table( "Untitled 8" ) << Summary( Group( :color ) );
// make sure "Untitled 8" is the correct title of the original data, containing a column named "color"
// transfer result to associative array
result = Associative Array(); // empty A.A.
For Each Row(new, result << Insert Item(:color, :N Rows)); // populate A.A.
Show(result); // display A.A. to log
Close(new, No Save); // close temporary summary table