-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colors not showing... ideas? #7
Comments
Hi! svg2img‘s work flow is as below: img => svg2img(prepare options) => canvg(parse SVG and draw on canvas) => node-canvas The problem looks like a parsing problem of canvg. If it's OK, you can post your SVG here, I will take a quick check if there is anything unnormal. |
Here's the svgstring, amazing response time 👍 |
Sorry for the late response. It may be related with external css. .axis {
stroke: #555;
stroke-width: .2;
}
.scale {
fill: #e7e7e7;
stroke: #999999;
stroke-width: .2;
}
.shape {
fill-opacity: .7;
stroke-width: .5;
}
.shape:hover {
fill-opacity: .6;
}
.shape.something1 { fill: #edc951; }
.shape.something2 { fill: #cc333f; }
.shape.something3 { fill: #00a0b0; } canvg doesn't support style defines in external CSS, as canvg/canvg#323. You can try to inline the styles, it may resolve your problem. |
OK thanks for the idea, but if external CSS doesn't work, but do the preceding styles get applied? |
canvg seems to only have limited support of preceding styles, as mentioned in canvg/canvg#414. I think the problem may come from the selector You may replace |
Desired image
Output image
The SVG string renders in codepen as desired, however, when I render it with svg2img I get the output as above. Any ideas where this might be going wrong?
My pipeline involves posting the rendered JPEG to s3, and then sending it via Facebook Messenger, and it hasn't gone wrong until now.
If you need any more info let me know, thanks for any help :)!
The text was updated successfully, but these errors were encountered: