#SVG of Cetz chart doesn't appear to import correctly

53 messages Β· Page 1 of 1 (latest)

clever maple
#

In an attempt to speed up compile times I've made a botch job attempt at externalizing my figures. This gives the svg attached. If I reimport it using image, I get the following in the document

frank gyro
#

@bleak hamlet

clever maple
#

This might be an issue with the PDF render because if I export the page itself (the actual document but with the svg import), I get the correct output

bleak hamlet
#

unfortunately this one doesn't have a fix yet :p unless you can somehow force typst to not use oklab color space

#

i'm not sure how svg export works

#

@wintry shuttle maybe in svg export we can not emit oklab for now? I think typst should have a function to convert to srgb no?

wintry shuttle
#

attached svg looks fine in browser?

bleak hamlet
#

well yes but resvg doesn't support oklab

#

(it's a resvg issue, but it would be good if in the meanwhile we avoid emitting oklab/icc-color in the svg export, and isntead just emit srgb colors)

wintry shuttle
#

i'm not sure about color mapping things. can we simply convert oklab to srgb? or it is not possible?

bleak hamlet
#

hmm is it possible? @junior jolt

junior jolt
#

That being said, I have the issue also of importing oklab colors in PowerPoint angryeyes

#

Because they don't actually support SVG correctly

#

We could probably have a --svg-compat mode that always uses RGB or something like that 😐

junior jolt
#

Since they rely on SVG being able to interpolate colors in oklab which is what makes them look good

#

and not require a bagilion stops

#

couldn't we just open a PR on resvg with oklab support?

#

I should also mention that oklab and oklch are officially supported SVG color spaces, not CSS or anything funky like that, pure SVG

bleak hamlet
bleak hamlet
#

it's a resvg issue

junior jolt
#

@clever maple in the meantime you can just map the colours to rgb since you're not using gradients πŸ˜‰

clever maple
#

Not too big a problem for me because I'm mainly using it to speed up compiles, but I'm perfectly happy with a longer compile for the "final" version

junior jolt
clever maple
junior jolt
#

when you do grad.sample(...) just add a .map(color.rgb) and you're done πŸ˜‰

clever maple
junior jolt
#

I was thinking of one typst file per chart that gets exported to SVG and then imported either as SVG or #include "..." depending on a CLI parameter maybe

clever maple
#

That's exactly how I'm doing it

junior jolt
#

So my midday break is about to be over and I have meetings galore πŸ˜„

#

So if you have questions I'll have a look later

clever maple
#

I have a monthly meeting with my industrial sponsors in an hour and I look forward to telling them how I've not done any lab work since last time because of a backlog on consumables orders

junior jolt
#

I am glad to be mostly working on simulations πŸ˜‚

#

I get models, I implement models, and I simulate

clever maple
#

Catboys when

junior jolt
#

Is it catboy DNA that is unavailable?

#

(would make sense tbh)

vapid acorn
clever maple
# junior jolt ah if you do then I would love to get that

Just learning how to use the typst cli query stuff: I imagine it doesn't work if multiple things have the sample label, so how would I go about getting all the relevant metadata to do this, surely this is already a solved problem?

junior jolt
vapid acorn