Closed 3D2Code closed 3 years ago
Hi @3D2Code ! You are lucky, this is no bug :)
You have to put colorMode(HSB,255)
inside the SVG recording, after beginRecord()
, otherwise it has no effect on the exported file (but it still has effect on your screen).
…
beginRecord(SVG,'filename.svg')
colorMode(HSB,255)
…
Let me seize this opportunity to invite you to join us at https://discourse.processing.org/c/processing-py/9 !
Thanks a bunch Villares. I will try to remember.
Not sure whether this is an issue or not. I am new to processing and and still trying to figure out the context/scope of setup vs draw.
When I run the following sketch, the screen shows circles in different hues per the colorMode(HSB,255) in setup. However, SVG export seems to interpret the line fill(int(random(255)),250,255) in RGB mode. Green and Blue channels are clamped to 250 and 255 respectively. So the SVG file shows a bunch of cyan tone circles. If I uncomment the colorMode(HSB,255) within draw(), the SVG file captures the same hues as shown on screen.
add_library('svg')
def setup(): size(800, 600) colorMode(HSB,255) beginRecord(SVG,'filename.svg')
frameRate(1)
def draw(): background(200)
colorMode(HSB,255)