Skip to content

rougier/emacs-svg-icon

Repository files navigation

Introduction

This library allows you to create SVG icons by parsing remote collections, whose license are compatible with GNU Emacs. The default size of an icon is exactly 2x1 characters, such that it can be inserted into text, without disturbing alignment. Note that each icon is cached locally, to speed-up loading the next time you use it. If for some reason the cache is corrupted, you can force reload using the svg-icon-get-data function.

Usage

;; Direct insertion
(insert-image (svg-icon "material" "attachment"))
(insert-image (svg-icon "bootstrap" "alarm"))
(insert-image (svg-icon "octicons" "alert"))
(insert-image (svg-icon "boxicons" "dizzy"))

;; Defining a "string icon"
(setq material-attach (propertize "--"
                      'display (svg-icon "material" "attachment")))

(insert (format "[%s]" material-attach))

Output

Available collections:

If you want to add a new collections (i.e. URL), make sure the icons are monochrome and that their sizes are consistent.

The built-in collections are:

  • Boxicons, available under a Creative Commons 4.0 license. As of version 2.07 (December 2020), this collection offers 1500 icons in two styles (regular & solid). Browse gallery

  • Octicons, available under a MIT License with some usage restriction for the GitHub logo. As of version 11.2.0 (December 2020), this collection offers 201 icons. Browse gallery

  • Material, available under an Apache 2.0 license. As of version 4.0.0 (December 2020), this collection offers 5000+ icons in 4 styles (filled, outlined, rounded, sharp). Browse gallery

  • Bootstrap, available under an MIT license. As of version 1.2.1 (December 2020), this collection offers 1200+ icons in 2 styles (regular & filled). Browse gallery

About

An emacs library to create SVG icons on the fly

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published