# 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:** 3\
**Page:** 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.

---

<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:24pm UTC](https://discuss.ocaml.org/t/jsofocairo-share-cairo-based-drawing-code-between-command-line-and-web-browser/575/2 "2017-07-19T18:24:38Z")

</div>

Taging a few people that may be particularly interested:

- @Chris00, I’m implementing your [package](https://github.com/Chris00/ocaml-cairo/)’s interface
- @Vincent_Balat, I’m not sure who to tag from Ocsigen

---

<div class="post-metadata">

**Author:** ![vramana](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/vramana/32/12_2.png) [@vramana](https://discuss.ocaml.org/u/vramana)\
**Post date:** [July 21, 2017, 7:53pm UTC](https://discuss.ocaml.org/t/jsofocairo-share-cairo-based-drawing-code-between-command-line-and-web-browser/575/3 "2017-07-21T19:53:00Z")

</div>


