[ANN] Vg 9.5.0 – Declarative 2D vector graphics


It’s my pleasure to announce the release 0.9.5 of Vg:

Vg is a declarative 2D vector graphics library. Images are values that
denote functions mapping points of the cartesian plane to colors and
combinators are provided to define and compose them.

Renderers for PDF, SVG, Cairo and the HTML canvas are distributed
with the library. An API allows to implement new renderers.

Vg is distributed under the ISC license.

Except for the addition of combinators to smoothly stitch Bézier paths by François Thiré, this is mostly a bureaucratic and maintenance release.

At the library level, the Vgr_svg module is now part of the vg library and the vg.svg library is deprecated. The Vgr_htmlc canvas renderer has been rewritten with brr which becomes an optional dependency of the package while the dependencies on js_of_ocaml and js_of_ocaml-ppx are dropped for good.

Ten years ago neither dark themes nor .mld files did exist so the tutorial, the semantics and the image howto have been slightly reworked and moved out of the Vg module documentation to their own pages and the doc images have been fixed to work in dark themes.

Read the release notes for all the other changes.

Homepage: https://erratique.ch/software/vg
API docs & manuals: https://erratique.ch/software/vg/doc/
Install: opam install vg (opam pr)



A big thanks to my donators.


A small physicist nitpicking on the the tutorial (that doesn’t deserve to be an issue):

Your eyes require a wavelength there and Gg.Color.void cannot provide it.

Both eyes and the electromagnetic fields require a linear mixture of wavelengths that will be projected to a color by the eye; but not really a wavelength. Typically, pink is not a wavelength.


Thank you for this release!

When using firefox (nightly 124.0a1) the page fails to load and I only see the black background. Opening the console in the inspector yields the following error:
When using chromium the page seems to work.

As far as I’m concerned, I can’t read the thin grey text on black… would you mind adding/replacing the theme with a black-on-grey one as you do in your usual documentation?

I’m not sure what you are refering to exactly as I’m not doing anything different in vg’s docs.

The default stylesheet of odig (those used here) simply picks up your browser preference.

I can’t reproduce but I suspect some kind of local storage (which stores the UI state) churn/bug. Try to destroy the local storage your have for erratique.ch (storage tab in the console).

damn, indeed, I was not aware that this could happen. Deleting the local storage did solve the issue. Thanks!

I found this in https://erratique.ch/software/vg/demos/db_viewer on l.78-79:

    body { color: gray;
           background-color: black;

Well it should not happen or rather one should not use Marshal in totally inconsiderate ways with local storage (still a bit surprising that Invalid_argument gets raised, the code protects against Failure). This was hastily ported to brr at some point, I suspect you had an old storage lying in your browser from a few years ago (?).

@grayswandyr, that’s not really part of the docs and has nothing to do with dark themes, it was always that way. It’s a demo and tool for developing Vg written a long time ago and I have to admit I don’t really have the time to micro manage that for now (it also requests fonts from google which I consider a sin).

1 Like

@grayswandyr if you can’t read the doc, you can probably cook yourself a bookmarklet to change the text contrast per your needs.

It’s a low tech solution that should work pretty well on any site, after a bit of fiddling.

1 Like