Color Swatches

There are a number of built-in swatches which can be used,

Distinct Color swatches

Function Color Palette
color-chart/web-safe-colors Web-safe
color-chart.lindsay/swatch Lindsay
color-chart.x11/swatch X11

Interpolated Color swatches

Function Color Palette
color-chart/spectrum Spectrum
color-chart/rainbow Rainbow
color-chart/hue Hue
color-chart/gradient :orange :blue 216 gradient1
color-chart/gradient :red :snow 216 gradient2
color-chart/heatmap 216 heatmap
color-chart/cube-helix 216 cube-helix

These palettes were generated with the following example:

(ns inkspot.examples
  (require [clojure.java.io :as io]
           [inkspot.color :as color]
           [inkspot.color-chart :as cc]
           [inkspot.palette :as palette]
           [inkspot.color-chart.lindsay :as lindsay]
           [inkspot.color-chart.x11 :as x11])
  (import [javax.imageio ImageIO]))

;; Distinct Color Swatches
(doseq [[k v] {:web-safe-colors (map color/coerce cc/web-safe-colors)
               :lindsay         (map color/coerce (vals lindsay/swatch))
               :x11             (map color/coerce (vals x11/swatch))}
        :let [f (io/file (str "example/palette/" (name k) ".png"))]]
  (ImageIO/write (palette/draw v :g2d-target palette/bitmap) "png" f))

;; Interpolated Color Swatches
(doseq [[k v] {:spectrum   (cc/spectrum 216)
               :rainbow    (cc/rainbow 216)
               :gradient1  (cc/gradient :orange :blue 216)
               :gradient2  (cc/gradient :red :snow 216)
               :heatmap    (cc/heatmap 216)
               :cube-helix (cc/cube-helix 216)}
        :let [f (io/file (str "example/palette/" (name k) ".png"))]]
  (ImageIO/write (palette/draw v :g2d-target palette/bitmap
                                 :cell-width 2 :cell-height 50
                                 :cells-per-row 216 :border 0) "png" f))

uiGradients

The gradients.json from uiGradients is loaded in (via a macro in clojurescript), and interpolated color swatches can be generated by specifying the color name. For example:

; Names can be specified as the named strings or kebab-case
(cc/ui-gradient :sea-blizz 240)
=> (#<Color java.awt.Color[r=28,g=216,b=210]> #<Color java.awt.Color[r=28,g=216,b=209]> ...

(cc/ui-gradient "Sea Blizz" 240)
=> (#<Color java.awt.Color[r=28,g=216,b=210]> #<Color java.awt.Color[r=28,g=216,b=209]> ...
Name Color Palette
:a-lost-memory a-lost-memory
:almost almost
:amethyst amethyst
:aqua-marine aqua-marine
:aqualicious aqualicious
:army army
:ash ash
:aubergine aubergine
:autumn autumn
:behongo behongo
:bloody-mary bloody-mary
:blurry-beach blurry-beach
:bora-bora bora-bora
:bourbon bourbon
:calm-darya calm-darya
:candy candy
:cheer-up-emo-kid cheer-up-emo-kid
:cherry cherry
:cherryblossoms cherryblossoms
:clouds clouds
:dance-to-forget dance-to-forget
:day-tripper day-tripper
:dirty-fog dirty-fog
:dracula dracula
:earthly earthly
:electric-violet electric-violet
:emerald-water emerald-water
:facebook-messenger facebook-messenger
:forever-lost forever-lost
:frozen frozen
:horizon horizon
:influenza influenza
:jonquil jonquil
:juicy-orange juicy-orange
:kashmir kashmir
:kyoto kyoto
:lemon-twist lemon-twist
:man-of-steel man-of-steel
:mango-pulp mango-pulp
:mantle mantle
:miaka miaka
:midnight-city midnight-city
:mirage mirage
:misty-meadow misty-meadow
:mojito mojito
:moonrise moonrise
:moor moor
:moss moss
:mystic mystic
:namn namn
:neon-life neon-life
:opa opa
:parklife parklife
:peach peach
:petrichor petrichor
:pinky pinky
:pinot-noir pinot-noir
:purple-paradise purple-paradise
:red-mist red-mist
:reef reef
:rose-water rose-water
:sea-blizz sea-blizz
:sea-weed sea-weed
:shadow-night shadow-night
:shore shore
:shrimpy shrimpy
:shroom-haze shroom-haze
:sirius-tamed sirius-tamed
:soundcloud soundcloud
:starfall starfall
:steel-gray steel-gray
:stellar stellar
:sunrise sunrise
:teal-love teal-love
:the-strain the-strain
:titanium titanium
:vasily vasily
:venice-blue venice-blue
:virgin virgin
:winter winter

The JSON file is packaged into the inkspot jar, but the uiGradients project is referenced as a git submodule and the intention is to keep it mostly up-to-date as new inkspot releases are published.