Color Loving, Functional Style

Who can we blame

I would like to blame all this on @edd_mann. The podcast he did with @stevenproctor on Episode #71 of was certainly the straw that broke the camel’s back, so to speak. Of course this is what led me to find out more about @stevenproctor and his fantastic functional programming podcast Functional Geekery. Like everyone who does any coding for their day job I’ve been meaning to check out what all the fuss was about ‘functional programming’. So whatever I can’t blame on Edd, I can certainly blame on Steven, because there was no turning back at this point. Once I made the decision that F# was to be the vehicle for my first functional foray, I next hit upon @ScottWlaschin‘s tour-de-force website And soon after that I learned about F# type providers from @tomaspetricek‘s brilliant talk on FSLab and doing Data Science, which totally blew my mind. So, I guess it’s at least partially Scott and Tomas’ fault as well ;)

Anyway, here’s a little F# project as a result.


This project sends a random color palette from the api at to a slack web-hook URL. At my employer we have a channel setup specifically for our graphic design department called colorlovers which is fed by this code. It is for color palette inspiration. Below is a screenshot.

Slack channel for Creatives

The code is written in F# and runs on Mac, Linux, and Windows. Essentially, the following summarizes what the code does.

  • uses the awesome F# JSON type provider to access the colour lover api found here
  • extracts, transforms, converts and stores the colors and their palette widths from the api
  • creates a graphical (400px x 50px) bitmap image of the palette and stores on disk for later web-serving
  • generates the JSON object representing the color palette image and link
  • posts all to the slack web-hook

The resulting .exe is a console application and can be run directly from the command line.

> ColorLover.exe // on windows
$ mono ColorLover.exe  // on unix

Or, like us, you may want to set it up as a cronjob and have it run every so often.

Build Requirements

The only package required is FSharp.Data. The package should install automatically when you ‘restore packages’.


This is the first thing I’ve written with F# and my first foray into functional programming. I’m sure the code could be made more succinct and improved. As I am learning, I would appreciate any comments or instruction you would care to offer. Simply open an issue on this repo.