Would it not be simpler to use the existing RGB colour support for picture windows?
For example:
//drawdot -r [color:red]@Example1 65535[/color] 10 10 10
//drawdot -r [color:red]@Example1 $rgb(100, 200, 50)[/color] 10 10 10
This way you don't have to deal with palettes at all.