1 |
# Choosing colors and 3-dotproduct factors for papers. |
# Choosing colors and 3-dotproduct factors for papers. |
2 |
|
|
3 |
from gfx.libcolor.spaces import getRandomColor,getRandomColor2,YSTtoRGB,clampSat |
from gfx.libcolor.spaces import getRandomColor,getRandomColor2,YSTtoRGB,clampSat,LtoY |
4 |
from gfx.libcolor.spaces import RGBtoLAB,LABtoRGB,LABclamp |
from gfx.libcolor.spaces import RGBtoLAB,LABtoRGB,LABclamp |
5 |
|
|
6 |
from math import sin,cos,atan2,pi,log |
from math import sin,cos,atan2,pi,log |
58 |
for i in range(0, colors)] |
for i in range(0, colors)] |
59 |
|
|
60 |
# Construct colors and clamp to RGB cube keeping hue and luminance constant |
# Construct colors and clamp to RGB cube keeping hue and luminance constant |
61 |
yst = [(pow((lums[i] + 16.0) / 116, 3), |
yst = [ ( LtoY(lums[i]), |
62 |
sats[i] * cos(hues[i]*pi/180), |
sats[i] * cos(hues[i]*pi/180), |
63 |
sats[i] * sin(hues[i]*pi/180)) |
sats[i] * sin(hues[i]*pi/180) ) |
64 |
for i in range(0,colors)] |
for i in range(0,colors)] |
65 |
|
|
66 |
col = [clampSat(YSTtoRGB(c)) for c in yst] |
col = [clampSat(YSTtoRGB(c)) for c in yst] |
67 |
shuffle(col, rnd.nextDouble) |
shuffle(col, rnd.nextDouble) |