Skip to content
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

Set classes in SVG and generate all variants with CSS #5

Open
bobek opened this issue Aug 24, 2020 · 1 comment
Open

Set classes in SVG and generate all variants with CSS #5

bobek opened this issue Aug 24, 2020 · 1 comment

Comments

@bobek
Copy link

bobek commented Aug 24, 2020

I would like to suggest the following, feel free to close if you don't want to follow this path.

  • picking SVG as the only source format (e.g. drop ppt), so there is no ambiguity what to edit
  • add class attribute to objects in SVG
  • use CSS to generate various variants

For example, this is the text node for one of the Type boxes. As you can see, I've added class="normal_label" attribute. You can do it directly in Inkscape as well.

<text               
   class="normal_label"
   inkscape:label="text125"
   fill="#bfbfbf"   
   font-family="Calibri, Calibri_MSFontService, sans-serif"
   font-weight="400"
   font-size="24px" 
   transform="translate(838.371,658)"
   id="text125">Type</text>

image

I can now create PDF or PNG directly from SVG on commandline with rsvg-convert from librsvg2-bin package (on Debian). For example

rsvg-convert -f pdf rust-memory-container-cs.svg > normal.pdf

will generate PDF as in SVG. So it will look like this
image

But CSS will allow to change attributes based on selectors, such as classes. So if red_labels.css looks like

.normal_label {
  fill: #ff0000;
}

and covert to pdf with

rsvg-convert -f pdf -s red_labels.css rust-memory-container-cs.svg > styled.pdf

image

@usagi
Copy link
Owner

usagi commented Aug 24, 2020

It's a nice suggestion. I cannot assign just now, but I'll try the issue to the next "rev.2". Of course PR is welcome if someone try it soon.

@usagi usagi mentioned this issue Aug 24, 2020
@usagi usagi modified the milestones: rev.2, rev.3 Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants