ForColormap, a Fortran library for colormaps 🌈

:rainbow: ForColormap 0.9 was just released after nearly 5 months’ work and 162 commits. Most new code and functionalities were written by @Ali, the CMake (>=3.24) build system and its GitHub CI workflow by jchristopherson, and the logo by @alozada. And @Ali also added CI workflows for fpm testing and FORD documentation. ForColormap is now using his ForImage project as a fpm (and CMake) dependency for writing PPM files (and ForColormap will later benefit from its image manipulating functions). Among novelties listed in the CHANGELOG, we can cite:

  • a colorbar() method to write a PPM file with the colorbar of a colormap,
  • a reverse() method to reverse a colormap,
  • a shift() method to apply a circular shift to a colormap,
  • methods create_lagrange() and create_bezier() to create a colormap from continuous interpolation of control colors,
  • an extract() method to extract a discrete colormap from a continuous colormap,
  • introspection via the src/colormaps_info.f90 module,
  • the FORD documentation https://vmagnin.github.io/forcolormap/,
  • a ForColormap PDF manual showing all the available colormaps, and a web page to help users choose a colormap,
  • new examples,
  • a gallery/ directory with screenshots of simulations using ForColormap,
  • a few new colormaps, especially the “magma”, “inferno”,“plasma” and “viridis” matplotlib colormaps and a “black_body” colormap.

I have added a new example in the gtk-fortran-extra repository. It uses ForColormap and creates a movie with Turing patterns (using the Reaction Diffusion Gray-Scott Algorithm), displayed with various colormaps:

(You can easily adapt that model to your favorite graphical library, the scientific part is in the scientific_computing.f90 file and references are provided in the README.)

Feedback is welcome. If you use ForColormap with other graphical C libraries, we are especially interested by the way you pass the RGB values to these libraries. Feedback by Windows users will also be useful, and also if you test ForColormap with compilers other than GFortran and Intel.

The main goal of the future 1.0 version will be to offer a library with a stable API, to improve the FORD documentation and to follow the Diátaxis documentation framework (but probably new functionalities will also be added as ideas are numerous, more than our available working hours).

And if you are looking for a fun project with ForColormap, I suggest writing a Fortran version of Lenia (see also Wikipedia page), a continuous generalization of Conway’s Game of Life. I have found no Fortran Lenia on GitHub.

17 Likes