@staticmethod<EOL><INDENT>def colorHSB(h, s, b):<DEDENT>
H, S, B = float(h), float(s/<NUM_LIT:100>), float(b/<NUM_LIT:100>)<EOL>if S == <NUM_LIT:0.0>:<EOL><INDENT>return (B, B, B) <EOL><DEDENT>h = H / <NUM_LIT><EOL>i = math.floor(h)<EOL>f = h - i<EOL>v = B<EOL>p = v * (<NUM_LIT:1> - S)<EOL>q = v * (<NUM_LIT:1> - S * f)<EOL>t = v * (<NUM_LIT:1> - S * (<NUM_LIT:1> - f))<EOL>if i == <NUM_LIT:0>:<EOL><INDENT>return (v, t, b)<EOL><DEDENT>elif i == <NUM_LIT:1>:<EOL><INDENT>return (q, v, p)<EOL><DEDENT>elif i == <NUM_LIT:2>:<EOL><INDENT>return (p, v, t)<EOL><DEDENT>elif i == <NUM_LIT:3>:<EOL><INDENT>return (p, q, v)<EOL><DEDENT>elif i == <NUM_LIT:4>:<EOL><INDENT>return (t, p, v)<EOL><DEDENT>else: <EOL><INDENT>return (v, p, q)<EOL><DEDENT>
Given the H,S,B (equivalent to H,S,V) values for the HSB color mode,
convert them into the R,G,B values for the RGB color mode and return a
color tuple. This conversion is necessary because Cairo understands
only RGB(A).