# JsOfOCairo: share Cairo-based drawing code between command-line and web browser

**URL:** <https://discuss.ocaml.org/t/jsofocairo-share-cairo-based-drawing-code-between-command-line-and-web-browser/575>\
**Category:** Community\
**Tags:** announce\
**Created:** [July 19, 2017, 6:23pm UTC](https://discuss.ocaml.org/t/jsofocairo-share-cairo-based-drawing-code-between-command-line-and-web-browser/575 "2017-07-19T18:23:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![jacquev6](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jacquev6/32/318_2.png) [@jacquev6](https://discuss.ocaml.org/u/jacquev6)\
**Post date:** [July 19, 2017, 6:23pm UTC](https://discuss.ocaml.org/t/jsofocairo-share-cairo-based-drawing-code-between-command-line-and-web-browser/575/1 "2017-07-19T18:23:40Z")

</div>

Hello,

I’ve just released [JsOfOCairo](https://github.com/jacquev6/JsOfOCairo) on OPAM and @avsm suggested I announce it here.

JsOfOCairo lets you reuse Cairo-based drawing code in web browsers. It’s an adapter, implementing (a reasonable subset of) the interface of ocaml-cairo targeting HTML5 canvas elements as exposed to OCaml by js\_of\_ocaml.

This allows writing things like [DrawGrammar](https://jacquev6.github.io/DrawGrammar/) which… draws railroad diagrams of grammars expressed in EBNF. There are some examples on the interactive demo page.

---

_[View the full topic](https://discuss.ocaml.org/t/jsofocairo-share-cairo-based-drawing-code-between-command-line-and-web-browser/575)._
