An SVG drawing library for Crystal

Celestine Crystal CI Documentation badge

Celestine Logo

A neat library and DSL for creating graphics using SVG


Add to shards.yml

    github: redcodefinal/celestine

SVG Stuff It Can Do


  • Filters :( gonna need to design a whole system just for those
  • Full SVG support for all elements and attributes


First, all drawing is done through Celestine.draw this returns a string SVG element, or works on an IO. You can easily embed this into webpages for dynamic server side drawing of assets.

Celestine.draw takes a block which takes a Celestine::Meta::Context, the basis of all DSL calls in Celestine.

Celestine.draw do |ctx|

You can create objects to be drawn with one of two methods.

Celestine.draw do |ctx|
  # use this context's DSL methods
  ctx.rectangle do |r|
    r.x = 10
    r.y = 100
    r.fill = "black"
    r # You must return the drawable item at the end of the DSL method.

  # Create the object and add it manually
  r = Celestine::Rectangle.new
  r.x = 10
  r.y = 100
  r.fill = "black"
  ctx << r

A list of the Celestine types and their DSL methods

  • Celestine::Rectangle -> rectangle
  • Celestine::Circle -> circle
  • Celestine::Ellipse -> ellipse
  • Celestine::Path -> path
  • Celestine::Mask -> mask
  • Celestine::Text -> text
  • Celestine::Group -> group
  • Celestine::Image -> image
  • Celestine::Use -> use

Here's a quick and dirty intro to features. crash_course

Here are some more intricate examples. procedural_art

Real world examples made with Celestine. All of these are flat SVG files with no JS inside, using only functions built into Celestine.


HMU via issues or make a pull request or something I don't know.


  1. Fork it (https://github.com/redcodefinal/celestine/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request


github statistic
  • 14
  • 1
  • 1
  • 0
  • 2 days ago
  • March 29, 2020

MIT License

Synced at

Fri, 27 Nov 2020 05:27:29 GMT