Giter VIP home page Giter VIP logo

svg-lib's Introduction

SVG Library

svg-lib is an Emacs library that allows to create and display various SVG objects, namely tags, icons, buttons, progress bars, progress pies and dates. Each object is guaranteed to fit nicely in a text buffer ensuring width is a multiple of character width and height a multiple of character height.

Installation

M-x package-install RET svg-lib RET

Quick start

For the impatient, evaluate the following expression:

M-: (insert-image (svg-lib-tag "TODO"))

This should insert a SVG tag displaying “TODO” in a rounded box whose size is exactly 5 characters wide (because of padding).

Usage

Objects

  • svg-lib-tag LABEL
  • svg-lib-icon ICON
  • svg-lib-icon+tag ICON LABEL
  • svg-lib-button LABEL HOOK
  • svg-lib-progress-bar VALUE
  • svg-lib-progress-pie VALUE
  • svg-lib-date DATE

Styling

Each library object can be styled using a style property list that defines:

  • foreground color
  • background color
  • internal padding (tag and icon)
  • external margin (in char)
  • stroke width (in pixels)
  • corner radius (in pixels) for the rounded box
  • horizontal alignment (0 to 1) inside margins
  • width (in characters)
  • height as a scale of line height
  • scale (for icon)
  • ascent (for text)
  • crop-left to crop object on the left
  • crop-right to crop object on the right
  • collection to use for icon
  • font family
  • font size
  • font weight

Icon repositories

Icons can be created 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.

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. If you want to add new collections (i.e. URL), make sure the icons are monochrome, that their size is consistent and that they include a ‘viewBox’ node.

Material Design (7447 icons)

Open-source iconography for designers and developers.

Simple icons (2926 icons)

Over 2900 Free SVG icons for popular brands.

Bootstrap (> 2000 icons)

Official open source SVG icon library for Bootstrap.

Boxicons (1634 icons)

Simple Open Source icons carefully crafted for designers & developers.

Octicons (322 icons)

Octicons are a set of SVG icons built by GitHub for GitHub.

VSCode (209 icons)

Icons used in Visual Studio Code.

Screenshots

screenshot.png

screenshot-2.png

svg-lib's People

Contributors

rougier avatar tarsius avatar hyunggyujang avatar aruzeta avatar redblobgames avatar chookity-pokk avatar wyuenho avatar trengrj avatar agsdot avatar mrunhap avatar mskorzhinskiy avatar chenyanming avatar grolongo avatar hedyhli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.