ColourTrans SWIs use palette pointers, and the following conventions apply:
Value | Meaning |
---|---|
-1 | Current palette to be used |
0 | Default palette for specified screen mode to be used |
SWIs often use the mode term, and the following conventions apply:
Value | Meaning |
---|---|
-1 | Current mode to be used |
ColourTrans uses a weighted least squares function algorithm to calculate the colour in the palette that most closely matches the specified colour. The algorithm works by calculating the distance between the colours.
Where the desired colour is (R~d~, B~d~, G~d~), and the trial colour is (R~t~, B~t~, G~t~), then the distance formula is thus:
Distance = redweight x (R~t~-R~d~)^2^ + greenweight x (G~t~-G~d~)^2^ + blueweight x (B~t~-B~d~)^2^
Where redweight =2, greenweight =4 and blueweight = 1. These weights are set to provide the optimum solution.