Giter Club home page Giter Club logo

dali's Introduction

dali

I do not understand why, when I ask for grilled lobster in a restaurant, I'm never served a cooked telephone. -- Salvador Dalí

dali is a Clojure library for representing the SVG graphics format. It allows the creation and manipulation of SVG files. The syntax used to describe the graphical elements is based on hiccup with a few extensions.

The main advantage of dali is that it provides facilities to perform complex layouts without having to position elements explicitly.

Here's a hello world for dali:

(require '[dali.io :as io])

(def document
 [:dali/page
  [:circle
   {:stroke :indigo :stroke-width 4 :fill :darkorange}
   [30 30] 20]])

(io/render-svg document "hello-world.svg")

;;you can also rasterize directly using Batik:
(io/render-png document "hello-world.png")

Here's a more substantial example of the kind of SVG you can produce with dali without having to specify the exact coordinates to position the elements:

[source for diagram]

Using dali in your project

Before adding dali as a dependency, please consider that it's still alpha quality and the API and syntax can (and very likely will) change. Just add this to the dependencies of your project.clj:

[dali "1.0.2"]

Or this, to your deps.edn:

dali/dali {:mvn/version "1.0.2"}

Documentation

Roadmap

Planned for the future:

  • Porting basic functionality to ClojureScript.
  • More pre-fabricated elements.

Contributors

License

Copyright © 2014-2020 Stathis Sideris

Distributed under the Eclipse Public License, the same as Clojure.

dali's People

Contributors

stathissideris avatar otfrom avatar gremid avatar pfeodrippe avatar onealexharms avatar rgkirch 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.