Hue

Hue[h]

represents a color in the HSB color space with hue h.

Hue[h,s,b]

specifies colors in terms of hue, saturation and brightness.

Hue[h,s,b,a]

specifies opacity a.

Hue["string"]

returns a color from an HTML color name etc.

Hue[color]

returns the HSB representation of color.

Details

  • Hue is also known as HSB (hue, saturation and brightness) or HSV (hue, saturation and value).
  • Hue corresponds to a cylindrical transformation of RGBColor, typically used for color picking, allowing for easier interpretation of color parameters.
  • The parameters h, s, b, and a must all be between 0 and 1. Values of s, b, and a outside this range are clipped. Values of h outside this range are treated cyclically. »
  • As h varies from 0 to 1, the color corresponding to Hue[h] runs through red, yellow, green, cyan, blue, magenta, and back to red again. »
  • Hue[color] can be used to convert any ColorQ expression to HSB.
  • Hue["htmlcolor"] can be used to represent the HTML color "htmlcolor" in the HSB space.
  • If no opacity has been specified, Hue[h,s,b] is equivalent to Hue[h,s,b,1].
  • Hue[h,s,b,a] is equivalent to {Hue[h,s,b],Opacity[a]}.
  • Hue[h] is equivalent to Hue[h,1,1]. »
  • The alternative forms Hue[{h,s,b}] and Hue[{h,s,b,a}] can also be used. »
  • On monochrome output devices, a gray level based on the brightness value is used.
  • ColorConvert can be used to convert Hue to other color spaces.
  • The following wrappers can be used around colors:
  • ColorsNear[color,]specifies a region around color
    Directive[,color,]specifies a color in combination with other directives
    Glow[color]specifies color independent of lighting »
    Opacity[a,color]specifies a color with an opacity a
    Style[expr,color]displays expr with the specified color »
  • For 3D surfaces, explicit Hue directives define surface colors; the final shading depends on lighting.

Examples

open allclose all

Basic Examples  (4)

Specify the color of graphics primitives:

Specify the color with opacity:

Specify the output color of expressions:

Specify the color of plots:

Scope  (3)

Colors in 3D  (1)

Use diffuse surface color:

Use diffuse and specular surface color:

Use glow color, setting the diffuse surface color to black:

Color Operations  (2)

Use Blend to mix two or more colors:

Use Lighter and Darker to mix with white and black respectively:

Generalizations & Extensions  (3)

Hue[h] is equivalent to Hue[h,1,1]:

Hue[{h,s,b}] is equivalent to Hue[h,s,b]:

Use Opacity with Hue:

Use the opacity argument in Hue directly:

Applications  (8)

Visualization  (3)

Select complementary colors, by selecting them maximally apart on the color wheel:

Color the filling according to the argument of a complex function:

Color the surface according to the argument of a complex function:

HSB Color Model  (5)

Plot the iso hue surfaces from the RGB cube. The hues are 0 (red), 1/6 (yellow), 2/6 (green), 3/6 (cyan), 4/6 (blue), and 5/6 (magenta). The primary colors are red at 0, green at 1/3, and blue at 2/3. The secondary colors are mixtures of two primary colors, so yellow at 1/6 is a mixture of equal parts red and green, etc.:

Manipulating the hue component interactively makes this easier to understand:

Plot the iso saturation surfaces from the RGB cube. The resulting iso surfaces are hexagonal cones, and the HSB color model is also known as the hexcone model:

Saturation for RGBColor[r,g,b] is given by (Max[r,g,b]-Min[r,g,b])/Max[r,g,b], so saturation 0 corresponds to the gray line, i.e. :

Saturation 1 corresponds (see above) to the surfaces , , or :

Manipulating the iso saturation surfaces makes it more intuitive:

Plot the iso brightness surfaces. The brightness for RGBColor[r,g,b] is given by Max[r,g,b], maximal output from any color channel:

Brightness 0 corresponds to black, i.e. RGBColor[0,0,0]:

Brightness 1 corresponds to the planes , , or :

Manipulating the iso brightness surfaces makes it more intuitive:

Plot iso chroma or colorfulness surfaces in the RGB cube. The chroma c for Hue[h,s,b] is given by c==s b, resulting in saturation sc/b:

Chroma for RGBColor[r,g,b] is the distance to the gray point with the same brightness. The resulting formula is Max[r,g,b]-Min[r,g,b], which can also be used to visualize the following:

Chroma 0, the achromatic colors, corresponds to the gray line :

Manipulating the iso chroma surfaces gives more intuition:

Combine the iso saturation and iso brightness surfaces and show that the intersection is a polygonal curve. The hue is the fraction of length around this polygonal curve in the counterclockwise direction as seen from the white RGB corner, i.e. , starting at red:

Iso saturation and iso brightness intersect at the hue curve, a polygonal curve with six vertices:

Properties & Relations  (1)

The hue value is cyclic with period 1:

Saturation determines how vivid the color is:

Brightness determines the brightness of the color:

A portion of HSB color space with maximal brightness:

Possible Issues  (1)

Saturation and brightness values outside of the 0, 1 range will be clipped:

In plot functions, use ColorFunctionScaling to control global scaling of variables:

Neat Examples  (3)

Visualizing the HSB color space:

Dynamically view the color planes in the brightness direction:

HSB noise with opacity:

Wolfram Research (1991), Hue, Wolfram Language function, https://reference.wolfram.com/language/ref/Hue.html (updated 2021).

Text

Wolfram Research (1991), Hue, Wolfram Language function, https://reference.wolfram.com/language/ref/Hue.html (updated 2021).

CMS

Wolfram Language. 1991. "Hue." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Hue.html.

APA

Wolfram Language. (1991). Hue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Hue.html

BibTeX

@misc{reference.wolfram_2024_hue, author="Wolfram Research", title="{Hue}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/Hue.html}", note=[Accessed: 14-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_hue, organization={Wolfram Research}, title={Hue}, year={2021}, url={https://reference.wolfram.com/language/ref/Hue.html}, note=[Accessed: 14-December-2024 ]}