Godtone (talk | contribs)
→Isomorphic keyboard code for launchpads with programmer mode: add idiosyncratic 53-colour rainbow (rb53) based on mostly being a subset of the idiosyncratic 80-colour rainbow (rb80); see NOTE: about rel=1 (or equivalently relative=True))
Godtone (talk | contribs)
→Isomorphic keyboard code for launchpads with programmer mode: ADD APPROXIMATE 6-BIT RGB (2 bits per channel) USING TUPLE INDEXING (R,G,B) in [0,1,2,3]; also add two functions based on it (rb and gencolcube)
Line 1,589: Line 1,589:
rb53 = [2, 83, 47, 99, 51, 61, 105, 1, 8, 116, 66, 40, 44, 5, 45, 70, 124, 21, 4, 33, 113, 115, 119, 102, 104, 13, 54, 54, 13, 104, 102, 119, 115, 113, 33, 4, 21, 124, 70, 45, 5, 44, 40, 66, 116, 8, 1, 105, 61, 51, 99, 47, 83]
rb53 = [2, 83, 47, 99, 51, 61, 105, 1, 8, 116, 66, 40, 44, 5, 45, 70, 124, 21, 4, 33, 113, 115, 119, 102, 104, 13, 54, 54, 13, 104, 102, 119, 115, 113, 33, 4, 21, 124, 70, 45, 5, 44, 40, 66, 116, 8, 1, 105, 61, 51, 99, 47, 83]
colmaps[53] = rb53
colmaps[53] = rb53
rgb = { # crude approximation of 6-bit colour using a 64-colour subset of the 128 factory colours. see zil24 for an example usage.
(0,0,0): 0, (1,1,1): 1, (2,2,2): 2, (3,3,3): 3, # grayscale; note 112 works well for a lit version of black
(1,0,1): 51, (2,0,2): 55, (3,0,3): 53, (3,1,3): 94, (3,2,3): 52, # pinks
(1,0,0): 121, (2,0,0): 120, (3,0,0): 60, (3,1,1): 107, (3,2,2): 56, # reds
(1,1,0): 63, (2,2,0): 14, (3,3,0): 13, (3,3,1): 109, (3,3,2): 113, # yellows
(0,1,0): 23, (0,2,0): 76, (0,3,0): 87, (1,3,1): 86, (2,3,2): 20, # greens; i think 87 = 21 but maybe 87 is lighter?
(0,1,1): 39, (0,2,2): 38, (0,3,3): 37, (1,3,3): 36, (2,3,3): 91, # cyans
(0,0,1): 47, (0,0,2): 46, (0,0,3): 45, (1,1,3): 44, (2,2,3): 93, # blues
(2,1,1): 70, (2,2,1):125, (1,2,1): 19, (1,2,2): 91, (1,1,2): 48, (2,1,2): 54, # "dull"/desaturated primaries
# (2,2,1) could be any of (62?, 63?,) 110, 105, 125, (1,2,1): 19 is sus but cant see better
(2,1,0): 11,  (1,2,0): 18, (0,2,1): 26, (0,1,2): 66, (1,0,2): 50, (2,0,1): 59, # "dark rainbow"
(3,1,0): 84,  (1,3,0): 17, (0,3,1): 25, (0,1,3): 79, (1,0,3): 80, (3,0,1): 58, # "bright"/offset additive primaries
(3,2,0): 96,  (2,3,0): 98, (0,3,2): 29, (0,2,3): 41, (2,0,3): 49, (3,0,2): 95, # "neon"/offset subtractive primaries
(3,2,1): 108, (2,3,1): 75, (1,3,2): 28, (1,2,3): 92, (2,1,3): 81, (3,1,2): 82 # "pastel"/deeply nontrivial
}
# for use with iso(1,8), iso(1,4), iso(8,1), iso(4,1) specifically so that each 4x4 area corresponds to a slice of the 4x4x4 cube
def gencolcube(Ridx=0,Gidx=1,Bidx=2):
global rgb
cc = []
for j in range(8):
for i in range(8):
idx = (i%4, j%4, i//4*2+j//4) # R=right, G=up, B=outer
cc.append(rgb[( idx[Ridx], idx[Gidx], idx[Bidx] )])
return cc
# a way of generating approximate rainbows based on the 6-bit colour approximation, using a pattern of high, medium and low strength
def rb(h,m,l):
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)]]