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.
(->hsl {:keys [type] :as color})
Converts a color to hsl.
Converts a color to hsl.
(->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.
(->hsla {:keys [type] :as color})
Converts a color to hsla.
Converts a color to hsla.
(->rgb {:keys [type] :as color})
Converts a color to rgb.
Converts a color to rgb.
(->rgba {:keys [type] :as color})
Converts a color to rgba.
Converts a color to rgba.
(-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'
(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).
(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.
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.
(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.
(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.
(has-alpha? color)
Returns true if the color has an alpha parameter.
Returns true if the color has an alpha parameter.
(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!
(hsl [hue saturation lightness])
(hsl hue saturation lightness)
Creates an hsl CSSColor record.
Creates an hsl CSSColor record.
(hsl->rgb {:keys [value] :as hsl-color})
https://www.rapidtables.com/convert/color/hsl-to-rgb.html Hsl -> rgb, hsla -> rgba.
https://www.rapidtables.com/convert/color/hsl-to-rgb.html Hsl -> rgb, hsla -> rgba.
(hsla [hue saturation lightness alpha])
(hsla hue saturation lightness)
(hsla hue saturation lightness alpha)
Creates an hsla CSSColor record.
Creates an hsla CSSColor record.
(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.
(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.
(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.
(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).
(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.
(opposite-hue color)
Rotates a color's hue by 180°.
Rotates a color's hue by 180°.
(rgb [red green blue])
(rgb red green blue)
Creates an rgb CSSColor record.
Creates an rgb CSSColor record.
(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.
(rgb->hsl {:keys [value] :as rgb-color})
https://www.rapidtables.com/convert/color/rgb-to-hsl.html Rgb to hsl, rgba to hsla.
https://www.rapidtables.com/convert/color/rgb-to-hsl.html Rgb to hsl, rgba to hsla.
(rgba [red green blue alpha])
(rgba red green blue)
(rgba red green blue alpha)
Creates an rgba CSSColor record.
Creates an rgba CSSColor record.
(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.
(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)
(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.
(scale-alpha color value)
Multiplies a color's alpha by a given value.
Multiplies a color's alpha by a given value.
(scale-lightness color value)
Multiplies a color's lightness by a given value.
Multiplies a color's lightness by a given value.
(scale-saturation color value)
Multiplies a color's saturation by a given value.
Multiplies a color's saturation by a given value.
(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.
(triad-next color)
Rotates a color's hue by 120°.
Rotates a color's hue by 120°.
(triad-previous color)
Rotates a color's hue by 240°.
Rotates a color's hue by 240°.
(with-alpha color alpha)
Given a color, sets its alpha to a given value.
Given a color, sets its alpha to a given value.
(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.
(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.
(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.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close