add gradient scale, remove TODO.
moved toRGB outside layer2list as an exportable function so that it can be used in legend generation.
proof-of-concept for legend generation.