manateelazycat / emacs-svg-icon

An emacs library to create SVG icons on the fly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

This library allows to create svg icons by parsing remote collections whose license are compatibles with GNU Emacs. The default size of an icon is exactly 2x1 characters such that it can be inserted inside a text without disturbing alignment. Note that aach 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 new collections (i.e. URL), make sure the icons are monochrome and that their size are consistent. Currently, 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

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 100.0%