Change the Color of SVG Icons in Elementor

Illustrator interface with the color picker open
Editing a blue cube in Adobe Illustrator. The color picker is open to adjust the hue.

Table of contents

Step-by-step video

What is an SVG file?

Scalable Vector Graphics (SVG) is a web-friendly vector file format. Unlike pixel-based raster files such as JPEGs, vector files store images using mathematical formulas based on points and lines on a grid. This means vector files like SVG can be resized significantly without losing any quality, making them ideal for logos and complex online graphics.

Bee - SVG

SVG – Size 3 KB

Bee - PNG - 1024px

PNG (1024px) – Size 85 KB

Bee

PNG (150px) – Size 13 KB

The size of an SVG file depends on how much image data it contains, but it’s generally smaller than most other file types. Complex graphics with many paths and anchor points will take up more storage space than simpler, cleaner designs.

It’s not just their scalability that makes SVGs so popular with web designers. SVGs are written in XML code, which means they store any text information as literal text rather than shapes. This allows search engines like Google to read SVG graphics for their keywords, which can potentially help a website rank higher in search results.

You can easily spot an SVG file by its .svg extension.

History of the SVG file

The history of the SVG file goes back to the late 1990s, when the World Wide Web Consortium (W3C) invited developers to submit proposals for a new type of vector graphic format. Six competing proposals were submitted and helped shape what ultimately became the W3C’s SVG format.

SVGs took a while to grow in popularity. There was relatively little support for them until 2017, when people began to see the benefits of using SVG in modern web browsers. SVG files are now widely used for 2D website images because most browsers and vector drawing applications can handle them easily.

What are SVG files used for?

Scalable vector graphics have come a long way in recent years, but what are SVGs used for in practice?

Website icons and logos.

Designers often use SVG to display website icons such as buttons, as well as company logos. This file type’s ability to scale up or down without compromising quality makes it ideal for graphics that need to appear in multiple places and in a variety of sizes.

Infographics and illustrations.

Thanks to the use of XML within SVG files, search engines like Google can read charts and graphs with lots of text, which can help with search engine optimization. Because Google can detect keywords within SVGs, it can potentially push a web page to a higher ranking in search results. Plus, to help make web pages much more engaging, SVGs also support animation.

Pros and cons of SVG files

It’s worth looking into the advantages and disadvantages of SVG before saving your images in this file format.

Advantages of SVG files

  • Unlike raster files, which are made up of pixels, vector graphics like SVGs always maintain their resolution, no matter how large or small you make them. You don’t have to worry about SVG images losing quality in certain browsers or when you resize them to appear in different places.
  • Basic SVG files are usually smaller than raster images, which are created from many colored pixels rather than using mathematical algorithms.
  • Because SVG files treat text as text (not as design), screen readers can scan any words contained in SVG images. This is very useful for people who need help reading web pages. Search engines can also read and index SVG image text.

Disadvantages of SVG files

  • SVG files are great for web graphics such as logos, illustrations, and charts. But their lack of pixels makes it difficult to display high-quality digital photos. JPEG files are generally better for detailed photographs.
  • Only modern browsers can support SVG images. You may find it challenging to use SVG files with Internet Explorer 8 and other older browsers.
  • The code inside SVG images can be hard to understand if you’re new to the file format.

How to add an SVG image with Elementor

There are many Elementor widgets that let us upload images or icons in SVG format. We can upload these files from the Media Library without any restrictions, but if we want to do it from the Elementor builder, we first need to enable Elementor’s ability to upload this type of file.

Allow unfiltered file uploads

This pop-up will appear when you click the Upload SVG button included in some widgets that use icons.

Allow unfiltered file uploads
Allow unfiltered file uploads

The first time you try to upload an SVG icon, you’ll see a warning message letting you know that uploading any file, including SVG files, can pose a potential security risk. If you understand the risks involved and agree to continue, click the Enable button.

This file is not allowed for security reasons

You’ll see this message when you try to upload an SVG file from the Image widget or another widget that isn’t specifically for uploading SVG icons.

This file is not allowed for security reasons
This file is not allowed for security reasons

You can fix it from the Elementor > Settings page.

  1. Click the Advanced tab.
  2. Under Allow unfiltered file uploads, select Enable from the dropdown menu.
  3. Click the Save Changes button.

Change the color of an SVG icon

In this tutorial, I’ll use Adobe Illustrator to create or modify SVG files. To be able to change the color of an SVG icon from the Elementor builder, the following must be true:

  • We must fill the entire icon (or the part we want to change from the Elementor builder) with the color #000000 (black in hexadecimal format).
Adobe Illustrator color picker
  • In Adobe Illustrator, we can set stroke (border) color and fill color. Elementor will only change the fill color, so it’s best not to assign a stroke color to the icon and leave only the fill color.
Change color with Adobe Illustrator
  • When we save the file in SVG format, Adobe Illustrator will show an SVG options dialog. In this dialog, make sure that under Advanced Options, the CSS Properties: selector is set to Presentation Attributes.
Save SVG file

Where to use our icon in the Elementor builder

Once we’ve created our icon following the guidelines above, we can use it in the Elementor builder in all of these widgets:

  • BASIC
    • Button.
    • Divider.
    • Icon.
  • PRO
    • Form.
    • Nav Menu.
    • Hotspot.
    • Flip Box.
    • Call to Action.
    • Reviews.
    • Table of Contents.
    • Video Playlist.
    • PayPal Button.
    • Stripe Button.
  • GENERAL
    • Icon Box.
    • Icon List.
    • Accordion.
    • Toggle.
    • Social Icons.
  • SINGLE
    • Post Info.

We can also use it as the Site Logo and in other widgets like Image, but without the ability to change the color from Elementor.

Insert SVG icon in Elementor

Useful links