question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inline the styles to be styling attributes when generating standalone SVG

See original GitHub issue

Might be useful to allow generating a standalone SVG document - #35 requested it. Right now I just generate an <svg> suitable for inserting into an HTML doc.

Just need to output the <svg> with the right namespace decls, and inline the style.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:7
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
tabatkinscommented, Mar 4, 2020

Okay, so an alternative approach: since my styling isn’t complicated in the first place, I can replace it with a few “fake selectors”, targetting each of the objects. So you’d specify it something like:

defaultStyle = {
  "line-color": "black",
  "line-width": "3px",
  "terminal-bg": "#ccffcc",
  ...
}

Then, if generating standalone, I can walk the graph and set attributes appropriately; otherwise, I can turn this into a stylesheet and append that, as appropriate.

1reaction
lurchcommented, Feb 29, 2020

The “standalone” diagrams generated by the online dingus still just display as black boxes when opened in Inkscape or Gnome’s Image Viewer? 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

Styling – SVG 1.1 (Second Edition)
Styling properties can be assigned using SVG's presentation attributes. For each styling property defined in this specification, there is a corresponding XML ...
Read more >
<style> - SVG: Scalable Vector Graphics - MDN Web Docs
The SVG <style> element allows style sheets to be embedded directly within SVG content. Note: SVG's style element has the same attributes as...
Read more >
How to Style Scalable Vector Graphics Using CSS
Instead of attributes, you can use inline styles with identical property names: ... Creating the SitePoint Logo as a CSS-Styled SVG.
Read more >
How do I create a style sheet for an SVG element?
Use an (X)HTML style element. If your SVG code is inline within an (X)HTML document, then the HTML <style> element can be used...
Read more >
Does not convert CSS attributes to XML attributes ... - GitLab
svg ). According to tooltip "Convert styles from style tags and inline style='' declarations into XML attributes." I would expect the behaviour ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found