Liking cljdoc? Tell your friends :D

tornado.colors

Everything related to colors: Mixing, color function such as rgb(a), hsl(a), color conversions, a map of available default colors, special function for modifying colors.

Everything related to colors: Mixing, color function such as rgb(a), hsl(a), color
conversions, a map of available default colors, special function for modifying colors.
raw docstring

->hslclj/s

(->hsl {:keys [type] :as color})

Converts a color to hsl.

Converts a color to hsl.
sourceraw docstring

->hsl?aclj/s

(->hsl?a color)

Converts a color to hsl/hsla, depending on whether the current form has an alpha value.

Converts a color to hsl/hsla, depending on whether the current
form has an alpha value.
sourceraw docstring

->hslaclj/s

(->hsla {:keys [type] :as color})

Converts a color to hsla.

Converts a color to hsla.
sourceraw docstring

->rgbclj/s

(->rgb {:keys [type] :as color})

Converts a color to rgb.

Converts a color to rgb.
sourceraw docstring

->rgbaclj/s

(->rgba {:keys [type] :as color})

Converts a color to rgba.

Converts a color to rgba.
sourceraw docstring

-mix-colorsclj/smultimethod

(-mix-colors color-type colors)

Calls a relevant function to compute the average of more colors. Presumes that the colors are converted to the same type by a function 'mix-colors'

Calls a relevant function to compute the average of more colors. Presumes that
the colors are converted to the same type by a function 'mix-colors'
sourceraw docstring

alpha-hex?clj/s

(alpha-hex? x)
source

colorclj/s

(color type value)
source

color->1-wordclj/s

(color->1-word color)

Assumes that clojure.core/name can be cast to the argument. Transforms all 3 versions (string, symbol, keyword) to a keyword with removed dashes (e.g. 'dark-red -> :darkred).

Assumes that clojure.core/name can be cast to the argument. Transforms all 3 versions
(string, symbol, keyword) to a keyword with removed dashes (e.g. 'dark-red -> :darkred).
sourceraw docstring

color?clj/s

(color? x)
source

CSS-Colorclj/s

source

darkenclj/s

(darken color value)

Same as (lighten color value), but the value is subtracted instead.

Same as (lighten color value), but the value is subtracted instead.
sourceraw docstring

default-colorsclj/s

Available default colors in tornado. Usage: {:color :black :background-color :crimson :border [[(u/px 1) :solid :yellow-green]]} etc. Tornado does the hex-code translation for you. Also, you can use both e.g. :yellow-green and :yellowgreen (or in string and symbol-forms, respectively), it all compiles to the same color.

Available default colors in tornado.
Usage: {:color            :black
        :background-color :crimson
        :border           [[(u/px 1) :solid :yellow-green]]}   etc.
Tornado does the hex-code translation for you.
Also, you can use both e.g. :yellow-green and :yellowgreen (or in string and
symbol-forms, respectively), it all compiles to the same color.
sourceraw docstring

desaturateclj/s

(desaturate color value)

Same as (saturate color value), but the value is subtracted instead.

Same as (saturate color value), but the value is subtracted instead.
sourceraw docstring

get-color-typeclj/s

(get-color-type color)

Returns the type of the given color, either :type of a CSSColor record or the argument's class. If the class cannot represent a CSS color, throws an exception.

Returns the type of the given color, either :type of a CSSColor record or the
argument's class. If the class cannot represent a CSS color, throws an exception.
sourceraw docstring

has-alpha?clj/s

(has-alpha? color)

Returns true if the color has an alpha parameter.

Returns true if the color has an alpha parameter.
sourceraw docstring

hex->rgbaclj/s

(hex->rgba color)
(hex->rgba color alpha)

Converts a color in hexadecimal string to an rgba color:

(hex->rgba "#20FF3f") => #tornado.types.CSSColor{:type "rgba", :value {:red 32 :green 255, :blue 63 :alpha 1}}

(hex->rgba "#20FF3f" 0.3) => #tornado.types.CSSColor{:type "rgba", :value {:red 32 :green 255, :blue 63 :alpha 0.3}}

(hex->rgba "#20FF3f3f") => #tornado.types.CSSColor{:type "rgba", :value {:red 32 :green 255 :blue 63 :alpha 0.24609375}}

(hex->rgba "#20FF3f" "20 %") => #tornado.types.CSSColor{:type "rgba", :value {:red 32 :green 255 :blue 63 :alpha 0.2}}

As you can see, this conversion is not case-sensitive. Do not use tornado.units/percent as the second argument!

Converts a color in hexadecimal string to an rgba color:

(hex->rgba "#20FF3f")
=> #tornado.types.CSSColor{:type "rgba", :value {:red   32
                                                 :green 255,
                                                 :blue  63
                                                 :alpha 1}}

(hex->rgba "#20FF3f" 0.3)
=> #tornado.types.CSSColor{:type "rgba", :value {:red   32
                                                 :green 255,
                                                 :blue  63
                                                 :alpha 0.3}}

(hex->rgba "#20FF3f3f")
=> #tornado.types.CSSColor{:type "rgba", :value {:red   32
                                                 :green 255
                                                 :blue  63
                                                 :alpha 0.24609375}}

(hex->rgba "#20FF3f" "20 %")
=> #tornado.types.CSSColor{:type "rgba", :value {:red   32
                                                 :green 255
                                                 :blue  63
                                                 :alpha 0.2}}

As you can see, this conversion is not case-sensitive.
Do not use tornado.units/percent as the second argument!
sourceraw docstring

hex?clj/s

(hex? x)
source

hslclj/s

(hsl [hue saturation lightness])
(hsl hue saturation lightness)

Creates an hsl CSSColor record.

Creates an hsl CSSColor record.
sourceraw docstring

hsl->hslaclj/s

(hsl->hsla {:keys [value]})

Hsl with alpha 1.

Hsl with alpha 1.
sourceraw docstring

hsl->rgbclj/s

(hsl->rgb {:keys [value] :as hsl-color})
https://www.rapidtables.com/convert/color/hsl-to-rgb.html
Hsl -> rgb, hsla -> rgba.
sourceraw docstring

hsl?clj/s

(hsl? x)
source

hslaclj/s

(hsla [hue saturation lightness alpha])
(hsla hue saturation lightness)
(hsla hue saturation lightness alpha)

Creates an hsla CSSColor record.

Creates an hsla CSSColor record.
sourceraw docstring

hsla?clj/s

(hsla? x)
source

lightenclj/s

(lighten color value)

Lightens a color by a given value: 0.15, (percent 15), "15%" work the same way.

Lightens a color by a given value: 0.15, (percent 15), "15%" work the same way.
sourceraw docstring

maybe-without-alphaclj/s

(maybe-without-alpha color)

If the color's alpha is 1, returns the same color without the alpha value.

If the color's alpha is 1, returns the same color without the alpha value.
sourceraw docstring

mix-colorsclj/s

(mix-colors color)
(mix-colors color1 & more)

Given any number of colors in any form (alpha-hex, non-alpha-hex, rgb, rgba, hsl, hsla), converts them to the most frequent type and mixes them.

Given any number of colors in any form (alpha-hex, non-alpha-hex, rgb, rgba,
hsl, hsla), converts them to the most frequent type and mixes them.
sourceraw docstring

named-color?clj/s

(named-color? x)

Returns true if the given color is in the name form and if it is contained in the default colors (e.g. :crimson, "dark-orchid", 'chocolate).

Returns true if the given color is in the name form and if it is contained in the
default colors (e.g. :crimson, "dark-orchid", 'chocolate).
sourceraw docstring

non-alpha-hex?clj/s

(non-alpha-hex? x)
source

opacifyclj/s

(opacify color value)

Opacifies a color by a given value: 0.15, (percent 15), "15%" work the same way.

Opacifies a color by a given value: 0.15, (percent 15), "15%" work the same way.
sourceraw docstring

opposite-hueclj/s

(opposite-hue color)

Rotates a color's hue by 180°.

Rotates a color's hue by 180°.
sourceraw docstring

rgbclj/s

(rgb [red green blue])
(rgb red green blue)

Creates an rgb CSSColor record.

Creates an rgb CSSColor record.
sourceraw docstring

rgb->hexclj/s

(rgb->hex {:keys [type value] :as color})

Converts an rgb/rgba CSSColor record to a hex-string. Rounds the hex-alpha of the color if the color is in rgba format.

Converts an rgb/rgba CSSColor record to a hex-string. Rounds the hex-alpha of
the color if the color is in rgba format.
sourceraw docstring

rgb->hslclj/s

(rgb->hsl {:keys [value] :as rgb-color})
https://www.rapidtables.com/convert/color/rgb-to-hsl.html
Rgb to hsl, rgba to hsla.
sourceraw docstring

rgb->rgbaclj/s

(rgb->rgba {:keys [value]})

Rgb with alpha 1.

Rgb with alpha 1.
sourceraw docstring

rgb?clj/s

(rgb? x)
source

rgbaclj/s

(rgba [red green blue alpha])
(rgba red green blue)
(rgba red green blue alpha)

Creates an rgba CSSColor record.

Creates an rgba CSSColor record.
sourceraw docstring

rgba->rgbclj/s

(rgba->rgb {:keys [value]})

Used for converting rgba to rgb since #'hex->rgba always returns rgba. Sometimes we might want and rgb color from that.

Used for converting rgba to rgb since #'hex->rgba always returns rgba.
Sometimes we might want and rgb color from that.
sourceraw docstring

rgba?clj/s

(rgba? x)
source

rotate-hueclj/s

(rotate-hue color angle)

Rotates hue of a color by a given angle in degrees for any color type, e.g. (rotate-hue "#00ff00" 90)

Rotates hue of a color by a given angle in degrees for any color type,
e.g. (rotate-hue "#00ff00" 90)
sourceraw docstring

saturateclj/s

(saturate color value)

Saturates a color by a given value: 0.15, (percent 15), "15%" work the same way.

Saturates a color by a given value: 0.15, (percent 15), "15%" work the same way.
sourceraw docstring

scale-alphaclj/s

(scale-alpha color value)

Multiplies a color's alpha by a given value.

Multiplies a color's alpha by a given value. 
sourceraw docstring

scale-lightnessclj/s

(scale-lightness color value)

Multiplies a color's lightness by a given value.

Multiplies a color's lightness by a given value. 
sourceraw docstring

scale-saturationclj/s

(scale-saturation color value)

Multiplies a color's saturation by a given value.

Multiplies a color's saturation by a given value. 
sourceraw docstring

transparentizeclj/s

(transparentize color value)

Same as (opacify color value), but the value is subtracted instead.

Same as (opacify color value), but the value is subtracted instead.
sourceraw docstring

triad-nextclj/s

(triad-next color)

Rotates a color's hue by 120°.

Rotates a color's hue by 120°.
sourceraw docstring

triad-previousclj/s

(triad-previous color)

Rotates a color's hue by 240°.

Rotates a color's hue by 240°.
sourceraw docstring

with-alphaclj/s

(with-alpha color alpha)

Given a color, sets its alpha to a given value.

Given a color, sets its alpha to a given value.
sourceraw docstring

with-alpha-paramclj/s

(with-alpha-param color)

Returns the color with alpha = 1 if it does not have an alpha value already. Hex or named color gets converted to rgba.

Returns the color with alpha = 1 if it does not have an alpha value already.
Hex or named color gets converted to rgba.
sourceraw docstring

with-hueclj/s

(with-hue color hue)

Given a color, transforms it into HSL and sets its hue to a given value.

Given a color, transforms it into HSL and sets its hue to a given value.
sourceraw docstring

with-lightnessclj/s

(with-lightness color lightness)

Given a color, transforms it into HSL and sets its saturation to a given value.

Given a color, transforms it into HSL and sets its saturation to a given value.
sourceraw docstring

with-saturationclj/s

(with-saturation color saturation)

Given a color, transforms it into HSL and sets its saturation to a given value.

Given a color, transforms it into HSL and sets its saturation to a given value.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close