Visit ComfyUI Online for ready-to-use ComfyUI environment
Convert Hex color values to HSL format for intuitive color manipulation in digital art and design.
The Hex to HSL node is designed to convert color values from the Hexadecimal (Hex) format to the Hue, Saturation, and Luminance (HSL) format. This conversion is essential for various applications in digital art and design, as HSL provides a more intuitive way to manipulate colors based on their visual properties. The node can handle both standard Hex colors and those with an alpha (transparency) component, making it versatile for different use cases. By converting Hex to HSL, you can easily adjust the hue, saturation, and luminance of colors, which is particularly useful for tasks like color correction, theme generation, and dynamic color adjustments in your artwork.
The hex_color
parameter is the input Hex color value that you want to convert to HSL. This should be a string starting with a #
followed by six or eight hexadecimal digits. The first six digits represent the red, green, and blue components of the color, while the optional last two digits represent the alpha (transparency) component. For example, #FF5733
represents an opaque color, while #FF573380
includes transparency. The function will strip the #
and process the remaining digits to perform the conversion.
The include_alpha
parameter is a boolean flag that indicates whether the alpha (transparency) component should be included in the output. If set to True
, the function will consider the last two digits of the Hex color as the alpha value and include it in the HSL output. If set to False
, the alpha value will be ignored, and the output will only include the hue, saturation, and luminance. The default value is False
.
The hue
parameter represents the color's hue in degrees, ranging from 0 to 360. It indicates the type of color, such as red, green, or blue, and is calculated based on the relative proportions of the red, green, and blue components in the Hex color.
The saturation
parameter represents the color's saturation as a percentage, ranging from 0% to 100%. It indicates the intensity or purity of the color, with 0% being completely desaturated (gray) and 100% being fully saturated.
The luminance
parameter represents the color's luminance as a percentage, ranging from 0% to 100%. It indicates the brightness of the color, with 0% being completely dark (black) and 100% being fully bright (white).
The alpha
parameter represents the color's transparency as a decimal value, ranging from 0.0 to 1.0. It is only included if the include_alpha
parameter is set to True
. A value of 0.0 means fully transparent, while 1.0 means fully opaque.
The hsl_string
parameter is a string representation of the HSL color, formatted as hsl(hue, saturation%, luminance%)
or hsla(hue, saturation%, luminance%, alpha)
if the alpha component is included. This string format is useful for CSS and other applications that require HSL color values.
include_alpha
parameter to handle colors with transparency, especially when working with layered images or designs that require blending.hsl_string
output for web design and CSS applications, where HSL values can be directly used to style elements.#
or contains invalid characters.#
followed by six or eight valid hexadecimal digits.include_alpha
to False
.© Copyright 2024 RunComfy. All Rights Reserved.