clojure2d.color.cssgram
Reimplementation of selection of instagram color filters.
- Webpage: https://una.im/CSSgram/
- Info: https://alistapart.com/article/finessing-fecolormatrix/
- Source: https://github.com/una/CSSgram
- Licence: MIT
Additionally there is an possibility to create custom color filter with custom-filter.
custom-filter
(custom-filter & defs)
Create a custom filter out of list of step definitions. A filter is a function wich returns new color for a given one.
Each step can be one of:
- a function which takes color and returs new color
- a vector with an operator name as a keyword and arguments
- one of the:
:sepia
,:contrast
,:exposure
,:brightness
,:grayscale
,:hue-rotate
,:saturation
,:tint
- with an amount as the argument (see below) :temperature
with temperature in Kelvins and amount (0.0-1.0):matrix
- feColorMatrix definition, see here:blend
for blending two colors, parameters are blednding operator and a color (see below)
- one of the:
Bleding operators are defined in clojure2d.color.blend/blends-list
plus :hue
, :saturation
, :luminocity
and :color
which copies one/two channels between colors in HSB color space. see here.
Note: CSS brightness
is defined as :exposure
which multiplies channels by given amount. :brightness
changes channels by adding a percentage of the original value.
Example: to construct moon filter, our definition will look like below:
(custom-filter [:blend :softlight (c/gray 0xa0)] [:blend :lighten (c/gray 0x38)] [:grayscale 1.0] [:contrast 1.1] [:exposure 1.1])