sure! some time ago someone needed something similar - they posted an extension, so maybe that will help: Exporting indices - #8 by Strupf
in general, you can use lua’s i/o library (file open, read, write, etc.): Programming in Lua (first edition) so it’s just a matter of getting the colour values, storing them in table and then writing content of that table to file.
2 Likes