/[gzz]/gzz/gfx/libpaper/colors.py
ViewVC logotype

Diff of /gzz/gfx/libpaper/colors.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by jvk, Mon Mar 3 14:09:54 2003 UTC revision 1.22 by jvk, Tue Mar 25 18:48:23 2003 UTC
# Line 26  Line 26 
26  from gfx.libcolor.spaces import getRandomColor,getRandomColor2,YSTtoRGB,clampSat,LtoY  from gfx.libcolor.spaces import getRandomColor,getRandomColor2,YSTtoRGB,clampSat,LtoY
27  from gfx.libcolor.spaces import RGBtoLAB,LABtoRGB,LABclamp  from gfx.libcolor.spaces import RGBtoLAB,LABtoRGB,LABclamp
28    
29  from math import sin,cos,atan2,pi,log  from math import sin,cos,atan2,pi,log,sqrt
30  from random import Random,shuffle  from random import Random,shuffle
31    
32  import java  import java
# Line 69  class Colors: Line 69  class Colors:
69    
70          # Take one half dark colors and one half light colors          # Take one half dark colors and one half light colors
71          lumrange = 100 - minlum          lumrange = 100 - minlum
72          lums = ([minlum + rnd.nextDouble() * lumrange/2          if colors == 1:
73                   for i in range(0,(colors+1)/2)] +              # Use the full luminance range for solid color backgrounds
74                  [minlum + (1 + rnd.nextDouble()) * lumrange/2              x = rnd.nextDouble()
75                   for i in range((colors+1)/2,colors)]              # Weight lower luminances more
76                  )              x = (1 - sqrt(1-x))
77                lums = [minlum + x * lumrange]
78            else:
79                lums = ([minlum + rnd.nextDouble() * lumrange/2
80                         for i in range(0,(colors+1)/2)] +
81                        [minlum + (1 + rnd.nextDouble()) * lumrange/2
82                         for i in range((colors+1)/2,colors)]
83                        )
84    
85          # Sample saturation:          # Sample saturation:
86          #  - take the most saturated color 2/3 of the time          #  - take the most saturated color 2/3 of the time

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26