File: crayola.py

package info (click to toggle)
python-visual 1%3A5.12-1.6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 7,708 kB
  • ctags: 7,635
  • sloc: cpp: 15,593; sh: 9,615; ansic: 6,631; python: 4,737; makefile: 384
file content (28 lines) | stat: -rw-r--r-- 408 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import colorsys

black = (0,0,0)
white = (1,1,1)

red = (1,0,0)
green = (0,1,0)
blue = (0,0,1)

yellow = (1,1,0)
cyan = (0,1,1)
magenta = (1,0,1)

orange = (1,0.6,0)

def gray(luminance):
  return (luminance,luminance,luminance)

def rgb_to_hsv(T):
  if len(T) > 3:
    T = T[:3]
  return apply(colorsys.rgb_to_hsv,T)

def hsv_to_rgb(T):
  if len(T) > 3:
    T = T[:3]
  return apply(colorsys.hsv_to_rgb,T)