c++ - Random pastel color for a brush -
i have several qpolygon
instances, need filled random colors (prefer pastels). can without creating array of colors or using predefined colors?
pastel colours, according wikipedia have:
high value , low intermediate saturation.
so can use fromhsv
method qcolor
class, giving random number range 0-359 h
, 0-128 (for example) s
, 192-255 (for example) v
parameter.
if don't want 2 colours 2 similar each other, can quantize ranges: draw random numbers 0-35, 0-12 , 19-25 (also, rough example) , multiply 10.
Comments
Post a Comment