let blend length =
let third = float (length -1) /. 3. in
let two_third = 2. *. third in
let black,red,yellow,white = 0x000000, 0xff0000, 0xfff000, 0xffffff in
Array.init length
(fun i ->
let i = float i in
if i < third then mix black red (i/.third)
else if i < two_third then mix red yellow ((i-.third) /. third)
else mix yellow white ((i-.two_third) /. third))