#SVG of Cetz chart doesn't appear to import correctly
53 messages Β· Page 1 of 1 (latest)
@bleak hamlet
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
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?
i just look at code and i think we do emit oklab color. see typst-svg/src/paint.rs:522
attached svg looks fine in browser?
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)
ah, make sense
i'm not sure about color mapping things. can we simply convert oklab to srgb? or it is not possible?
hmm is it possible? @junior jolt
yeah you could just map the gradient colors using color.rgb
That being said, I have the issue also of importing oklab colors in PowerPoint 
Because they don't actually support SVG correctly
We could probably have a --svg-compat mode that always uses RGB or something like that π
I don't think we can do this always because it will screw up gradients!
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
well yeah, the problem is someone needs to implement it π
yeah I know
it's a resvg issue
mood π
@clever maple in the meantime you can just map the colours to rgb since you're not using gradients π
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
I will need (soonβ’οΈ) to have lots of figures and I was thinking of using cetz for plotting, but I am starting to think against it π
Thanks! How would I do that? I'll drop a snippet to show how I'm generating the colours because it's through a gradient (basically I stole how you did the colours for the barchart you shared yesterday
when you do grad.sample(...) just add a .map(color.rgb) and you're done π
I know π
I've put together a quick and nasty externalisation wrapper, which I'll tie into a makefile with queries, I'll share this evening
ah if you do then I would love to get that
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
That's exactly how I'm doing it
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
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
oof
I am glad to be mostly working on simulations π
I get models, I implement models, and I simulate
Catboys when
you're the one doing lab work, you should know 
Is it catboy DNA that is unavailable?
(would make sense tbh)
ooh, that's definitely a use case I'll add to prequery!
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?
I never used typst query π
If multiple things have the same label you get multiple results (JSON array). I think there's an option --one or similar for when there's only one result; check --help for that π