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 | |
color-chart.lindsay/swatch | |
color-chart.x11/swatch |
Interpolated Color swatches
Function | Color Palette |
---|---|
color-chart/spectrum | |
color-chart/rainbow | |
color-chart/hue | |
color-chart/gradient :orange :blue 216 | |
color-chart/gradient :red :snow 216 | |
color-chart/heatmap 216 | |
color-chart/cube-helix 216 |
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 | |
:almost | |
:amethyst | |
:aqua-marine | |
:aqualicious | |
:army | |
:ash | |
:aubergine | |
:autumn | |
:behongo | |
:bloody-mary | |
:blurry-beach | |
:bora-bora | |
:bourbon | |
:calm-darya | |
:candy | |
:cheer-up-emo-kid | |
:cherry | |
:cherryblossoms | |
:clouds | |
:dance-to-forget | |
:day-tripper | |
:dirty-fog | |
:dracula | |
:earthly | |
:electric-violet | |
:emerald-water | |
:facebook-messenger | |
:forever-lost | |
:frozen | |
:horizon | |
:influenza | |
:jonquil | |
:juicy-orange | |
:kashmir | |
:kyoto | |
:lemon-twist | |
:man-of-steel | |
:mango-pulp | |
:mantle | |
:miaka | |
:midnight-city | |
:mirage | |
:misty-meadow | |
:mojito | |
:moonrise | |
:moor | |
:moss | |
:mystic | |
:namn | |
:neon-life | |
:opa | |
:parklife | |
:peach | |
:petrichor | |
:pinky | |
:pinot-noir | |
:purple-paradise | |
:red-mist | |
:reef | |
:rose-water | |
:sea-blizz | |
:sea-weed | |
:shadow-night | |
:shore | |
:shrimpy | |
:shroom-haze | |
:sirius-tamed | |
:soundcloud | |
:starfall | |
:steel-gray | |
:stellar | |
:sunrise | |
:teal-love | |
:the-strain | |
:titanium | |
:vasily | |
:venice-blue | |
:virgin | |
: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.