Godtone (talk | contribs)
Godtone (talk | contribs)
Isomorphic keyboard code for launchpads with programmer mode: add various functions for generating visually and mathematically interesting subsets of the approximation of 6-bit colour
Line 1,635: Line 1,635:
global rgb
global rgb
return [rgb[coord] for coord in [(h,l,l), (h,m,l), (h,h,l), (m,h,l), (l,h,l), (l,h,m), (l,h,h), (l,m,h), (l,l,h), (m,l,h), (h,l,h), (h,l,m)]]
return [rgb[coord] for coord in [(h,l,l), (h,m,l), (h,h,l), (m,h,l), (l,h,l), (l,h,m), (l,h,h), (l,m,h), (l,l,h), (m,l,h), (h,l,h), (h,l,m)]]
# a way of generating a nontrivial colour family as a rainbow
def nontrivialrb(h,m,l):
global rgb
return [rgb[coord] for coord in [(h,m,l), (m,h,l), (l,h,m), (l,m,h), (m,l,h), (h,l,m)]]
# a way of generating related nontrivial colours which differ only by light level (many interesting visuals)
def lightcycle(Ridx,Gidx,Bidx):
cycle = ['112','012','013','023','123','122']
return ' '.join([ c[Ridx]+c[Gidx]+c[Bidx] for c in cycle ])
# a way of generating the intensity spectrum of a colour EG intensityspectrum(1,0,1) for the trivial family of pinks
def intensityspectrum(r,g,b):
return ' '.join([ str(c[0])+str(c[1])+str(c[2]) for c in [(0,0,0), (r,g,b), (2*r,2*g,2*b), (3*r,3*g,3*b), (max(3*r,1),max(3*g,1),max(3*b,1)), (max(3*r,2),max(3*g,2),max(3*b,2)), (3,3,3)] ])


 
def rbs(h,m,l):
return ' '.join([ str(c[0])+str(c[1])+str(c[2]) for c in [(h,l,l), (h,m,l), (h,h,l), (m,h,l), (l,h,l), (l,h,m), (l,h,h), (l,m,h), (l,l,h), (m,l,h), (h,l,h), (h,l,m)]])