How to create an Angular Material svg iconset - svg

Does anybody know if SVG iconsets are working as of the current version? (1.0.7)
I'm strugling to use some custom svg with the md-icon directive but I haven't managed to see anything on the screen. Is there something broken or it's simply not implemented?
Any example of how to create and use an svg iconset file?
I know I can use the md-svg-src attribute to load one specific svg file providing its url, but that forces me to have all svgs on separated files and it also doesn't play well with the template cache.
Note: I'm using SVGs for the icons, not an icon font.

Related

I'm trying use flutter svg, but load with black svg

I'm trying to use Flutter SVG dependency, i put in the svg in assets, set in pubspec.yaml, and set in my widget, but, the svg load with black container
I've already tried change the svg, and the another svg works fine, but the other not...
final Widget svg = SvgPicture.asset(assetName, semanticsLabel: 'Acme Logo');
the svg in flutter
Here the svg
My expected response was colored svg like the link in codepen, but i got this
This is probably happened because of the corrupted SVG files from the internet. I faced this problem earlier and tried many ways to solve it. But finally, I solved it with the help of this software, svgcleaner.
Download the application into your OS, from here
After installation,
import your SVG.
Click run.
Success! Here you can see your SVGs' cleaned successfully.
After cleaning, you can grab those SVG files from the output folder location and add those files into your flutter app without seeing any black coloured SVG.
It works perfectly fine like this.
I think I am late but this might just help someone. Just make all the styles in your svg image use inline styling otherwise all colors and styling won't be rendered as the tag is not readable by the SvgPicture.
I tried this SVG asset with the latest version of jovial_svg, and it works great! Here's the result:
This version of jovial_svg should be released in a couple of days, but for now it's 1.1.4-rc.4.
(This asset helped me flesh out stylesheet support - thanks!)
I found this site it solved my problem with the svg file that was out of color.
https://iconly.io/tools/svg-cleaner
use this configuration in illustrator before you add it to your project.
https://user-images.githubusercontent.com/2842459/62599914-91de9c00-b8fe-11e9-8fb7-4af57d5100f7.png
If You don't have solution try to convert your image from svg to png and use:
Image.asset('assets/images/image.png',)
Some SVG images uses style tag and if you try to load such image using flutter_svg, image won't render as expected. Currently flutter_svg supports styling through inline styles only and not the style tag that some of SVG files may contain (in my case, I exported image from Adobe XD and it has all styles in tag). When you try to load such SVG images, you will get below error:
======== Exception caught by SVG =================================================================== The following UnimplementedError was thrown in parseSvgElement: The
element is not implemented in this library.
Style elements are not supported by this library and the requested SVG
may not render as intended.
If possible, ensure the SVG uses inline styles and/or attributes
(which are supported), or use a preprocessing utility such as
svgcleaner to inline the styles for you.
This error mentions to use inline style instead of style tag, you can use svgcleaner (as mentioned in #Alif's answer) or similar utility to convert SVG file with inline styling.
For more detials, refer this link to check SVG compatibility with flutter_svg and handling other use-cases
try this:
Container(
child: SvgPicture.asset(
'assets/images/image.svg',
fit: BoxFit.contain,
),
)

SVG styling not applying in illustrator

I'm generating an SVG in a web app and allowing users to save it; the SVG embeds the styles in the header of the image.
When a user opens it in their browser (testing in Chrome) it style properly:
However in Illustrator it seems the styles aren't being applied:
What am I missing? Download the actual SVG here.
The problem is really with Illustrator's SVG importer.
You probably have to choose between two solutions:
Tell your users that saved SVGs won't work with some programs (like Illustrator)
Modify your graph generating code so that it doesn't rely on CSS classes.
For example: change the elements that use
class="link"
To instead set the style properties explicitly:
fill="none" stroke="#aaa" stroke-width="2px"
Or maybe you can find a script on the net somewhere that does that for you.

Load and Manipulate an SVG with JS that isn't part of the DOM

I'm using leaflet js with custom markers. These markers need to move, change colors, and rotate. Movement is fairly simple as marker locations can be updated. For color I need to access a particular path on the image, which is an svg. Rotation should also be able to be handled if I can access the svg in js.
My thoughts on doing this were to load the svg in js, then modify this as needed before I assign it to a custom icon. Is there a simple way to load an svg in js so that it can be thusly manipulated without it being part of the DOM?
Any advice appreciated
If you want to manipulate an SVG with DOM methods but not include it in your main DOM, you'll want to use createDocumentFragment.

Links missing in SVG Sphinx inheritance diagrams

When I configure Sphinx's Graphviz extension to generate SVG output, using
graphviz_output_format = 'svg'
I am no longer able to click on the nodes of inheritance diagrams generated using the inheritance_diagram extension.
Is there a way to enable these links in an SVG diagram, or do they only work for PNG diagrams?
I had a similar experience with embedded dot graphs (graphviz directive in Sphinx). Doing a little digging (and testing), I've concluded:
When setting graphviz_output_format to png, sphinx handles this by doing a few extra things:
It has dot output both a .png and a corresponding .map file.
The rendered HTML includes a map section to "overlay" the png image with link targets.
When using SVG, the renderer omits the map section and only produces an SVG image. Since SVG supports links within the format (which dot correctly embeds), I presume it was expected the map section was redundant (or more likely problematic since it would "compete" with the SVG-rendered image for focus.)
As alluded to here, most browsers disable embedded SVG links (when surrounded by a <img> tag). The consequence is that the embedded links are not visible, and thus not clickable.
In my case when I open the SVG image directly in the browser, the embedded links are clickable (tested on Safari and Firefox).

Possible to take a svg made in illustrator and turn it into a raphael path to then animate?

Would like to take my logo made in illustrator then turn it into a svg so that i can then use Raphael to animate it. I know how to make a simple image by creating my own path using lineTo.
Didn't know if this is possible or not.
Thank you
Once you save your logo created with Illustrator as svg file, there is a way to convert the SVG into a Raphael object and then you can use it with Raphael library.
Chack out this website: http://irunmywebsite.com/raphael/SVGTOHTML_LIVE.php
If you can, open the page with Firefox. Chrome messes up the page. Good Luck.
Well, if its just the path you need without the colors, stroke widths etc, i would save the illustrator logo as an SVG and then open it with a text editor(say Notepad).
From there i would extract the d attribute as a path and manually add the rest of its ''features'' like colors,stroke widths etc.

Resources