Search code examples
pythoncolorsvisualizationpyx

How to generate any color in PyX


Many Visualisation libraries and languages provide easy ways of generating any color. for example you could simple add a style tag with a css color code to set the color of an object in html.

Is there a similiar way to set the color of a pyx drawing to any wanted color code instead of the predefined pyx color codes?

(for example something like color.code = #1122DD instead of color.rgb.blue)


Solution

  • Here is the way I found as the most convenient to have a simple RGB color:

    pyx.color.rgb(r,g,b)

    where r, g, b are numbers in the range [0, 1] and set the percentage of each base color in RGB format.