skip to Main Content
Creating SVG Icons For FileMaker

Creating SVG icons for FileMaker

Have you ever needed to create a FileMaker SVG icon from scratch because you can’t find the specific one you need? This post will tell you what you need to know to get you out of your pickle. <<Insert pickle icon here>> 🙂

It can be hard to find an icon set that has every symbol you need. I use the ones that come pre-loaded with FileMaker, but sometimes I need one that isn’t included in the default set. Since I want all my icons to blend in with each other, I’m left scouring the web to find something that fits in well with my chosen icon style. (There’s nothing that says “sloppy design” quicker than mis-matched icons…but maybe that’s just me.)

Finding icons

There are a few resources you can use to find icons. First, there’s always a Google search for the name of the symbol, plus the word “icon.” Or you can try searching an icon website such as Icon Finder, Icon Scout, or The Noun Project for your specific symbol. (These search results will also let you know if you’re onto the correct symbol for what you’re trying to represent.)

Be sure to check the licensing terms before you use any icon from the Web in your own work. Some icons are free or open-source (such as those from Material Design Icons), but others are for sale and/or have attribution requirements. 

It might be easiest for you to simply pay to get the icons you want. Given the skill, time, and effort that goes into creating an icon—and especially a comprehensive set of icons in a style you like—it can certainly save you oodles of time (read: money). You can try Streamline icons which are well worth the modest price. When you buy a set, you can be totally confident that they’ll blend seamlessly in your app.

Even so, you still might not find an icon in the exact style you want. Or you might not want to pay for a whole set just to get the one icon you need. Something I’ve been doing lately is drawing my own in SVG format. And, for some simple but perhaps hard-to-find icons, you can too. 

SVG what?

SVG stands for Scalable Vector Graphics format. FileMaker introduced support for SVG-formatted icons in FileMaker 14. It’s different from other graphics formats because instead of an image file, an SVG file consists of XML text that tells FileMaker how to draw the icon at any size or screen resolution. It means you can resize an icon in this format without losing any crispness on screen. And because it’s XML, SVG files are also considerably smaller than other graphics formats.

SVG format also gives you the added ability to set the colour of an icon based on the results of a calculation, using Conditional Formatting. This is incredibly useful if you’d like to show a different icon colour for an “active” vs. “disabled” button, for instance, based on certain data or conditions. To make this work, you need to modify the text of the SVG file slightly, and add the class “fm_fill” wherever you see the fill colour specified. (Instructions below.)

Creating your own icon

So, back to creating your own icon. I’m far from an SVG expert, but I have learned enough about it to successfully create icons for use in FileMaker, and I’m sure you can, too. I’m only going to focus on the practical steps for this post, and skip all the theory.

I’m using Sketch 49.3 (Mac only) for this demo. (Windows users, you may be able to adapt these instructions to Inkscape.) The end goal is to create an SVG file you can import as an icon in FileMaker. 

As an example, I’m going to show you how to draw a simple flag icon in Sketch, and then convert it for use in FileMaker. It consists of two shapes, the “flagpole” and the “flag.”

A note about Sketch: You can begin drawing directly on the canvas without creating an Artboard, but it’s easier to judge the scale of what you’re drawing by creating an Artboard first. Especially if you end up drawing a series of icons, it’s easier to compare them if they are on their own individual Artboards.

1. Setting up the Artboard:

  1. Create a new document in Sketch and select Insert > Artboard.
SVG1.1

2. Click “Create Custom Size,” found at the bottom of the Inspector panel on the right.

SVG1.2

3. Name the Custom Preset and enter 16px x 16px for the size. Click Save.

SVG1.3

4. In the Inspector panel, make sure “Custom” from the dropdown selector of Artboard sizes is selected.

SVG1.4

5. Select your custom preset as the size for the Artboard.

SVG1.5

Sketch creates the Artboard where you can now draw your icon.

SVG1.6

2. Drawing the icon:

  1. Zoom in on the Artboard so you can see it better.
SVG2.1

2. Insert a rounded rectangle Shape to create the “flagpole”.

SVG2.2

3. Make the size 1px x 14px.

SVG2.3

4. Remove the border attribute and make sure there is a fill attribute. Move the shape closer to the middle of the Artboard.

SVG2.4

5. Insert a Vector.

SVG2.5

6. Create the first point of your triangle “flag” by clicking on the empty Artboard to the right of the first shape. While holding down the shift key, click again at about the horizontal midpoint of the first shape. Click once more, up and to the right, to form the apex of the triangle, and then click your starting point again to close the shape.

SVG2.6

7. With the triangle selected, remove any border attributes and make sure there is a fill attribute.

SVG2.7

8. Using the Inspector, move the flagpole .5px closer to the flag. Adjust the size of the triangle to make it look more like a flag, if necessary.

SVG2.8

You now have an icon ready to be saved as an SVG file. You can save the Sketch file at this point if you like, and continue to add Artboards and icons to it as many times as you like.

Making a FileMaker-compatible SVG icon

The process to make an SVG icon fully compatible with FileMaker features is the same whether you draw the icon in Sketch yourself, or purchase an icon set that you open in Sketch. (I was able to open an EPS file containing a set of icons in Sketch, and then create SVG icons for use in FileMaker using this method. Note that Sketch can’t open AI files except as a single flattened layer.)

3. Creating the SVG file:

  1. Select both shapes and right-click or Control-click to select “Copy SVG Code”.
SVG3.1

2. Create a new Text Edit document and paste the copied text into it.

SVG3.2

3. Locate the “fill” tag containing the hex code for the fill colour.

SVG3.3

4. Next to this, insert a space, and then paste the following text: class=”fm_fill” (If you don’t type a space, your document won’t save properly.)

SVG3.4

Save your file and make sure to use the “.svg” extension at the end of the filename. TextEdit may warn you about this, but go ahead and save it anyway. (Note that if you want to open this file again later to edit it, you’ll have to either go to TextEdit and use File > Open, or right-click the file in the Finder, select Open With…Other and then locate the TextEdit app. If you simply double-click on the file in the Finder, it will open in Sketch.)

A note about adding the class=“fm_fill”. If you don’t add this, you’ll still be able to save the icon as SVG format, and import it into FileMaker. However, you won’t be able to change the icon fill colour—it will retain whatever fill colour it originally had in your Sketch file. FileMaker likewise won’t be able to change the icon fill colour using Conditional Formatting.

4. Importing the icon into FileMaker:

  1. In FileMaker, draw a button and double-click to bring up the Button Setup panel. Select the icon setup you want and click to add a new icon.
SVG4.1

2. Select your SVG icon file from your computer, and the icon will automatically update. Change the icon size if you wish.

SVG4.2

3. You can change the icon colour using the Inspector panel.

SVG4.3

4. If you wish, you can enter a calculation in the conditional formatting dialog to change the colour of the icon under certain circumstances.

SVG4.4

That’s it. Phew! It might seem like a lot, but once you get the hang of it, it goes pretty quickly. This is everything I wish I’d known when starting out with creating SVG icons. Perhaps now you’ll be inspired to create your own!

Bonus: You can take a Material SVG icon, open it in Sketch (double-click on Mac), and make the same alterations as above to make the fill responsive in FileMaker. Just make sure you copy only the icon shapes, and there are no other invisible artifacts present when you copy the icon, such as a masking rectangle. You can see these in the layers palette. Select the mask and delete it if present.

Links:

SVG Wikipedia page: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics

W3 Schools SVG Tutorial: https://www.w3schools.com/graphics/svg_intro.asp

FileMaker SVG Grammar for Buttons: https://fmhelp.filemaker.com/docs/edition/en/svg/

About Sketch Artboards: https://www.sketchapp.com/docs/grouping/artboards/

SVG 2 Language Reference: https://svgwg.org/svg2-draft/Overview.html

Grouping the “g” element: https://svgwg.org/svg2-draft/struct.html#TermContainerElement

Alexis Allen

I'm a certified FileMaker developer based in Toronto with over 20 years of experience. I've designed solutions for desktop publishing, signmaking, packaging design, marketing and advertising. I have presented several times at the FileMaker Developer's Conference in the US on the topic of design. As a lifelong student, I enjoy all creative pursuits.

This Post Has 3 Comments
  1. Thank you for sharing this, Alexis. I’ve downloaded and used a set of SVG icons from an I onset and it has most everything but I’m always missing something. I somehow thought it would take more effort to create one. As usual, we just think something is really complicated because we can’t see the entire procedure.

  2. Hi Alexis,

    Thank you for the article.

    What if we want to change the line color of the icon and not the fill? How do we have to change the svg code in order to accomplish that?

    Thanks for your help!

    1. I don’t think dynamically changing the stroke (border) options is supported by FileMaker. You can set a border colour in Sketch, but only the fill colour is changeable by FileMaker; the border colour will stay at whatever it was set to in Sketch originally.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top