Empowering CS learners, aspiring programmers, and startups with AI, Data Science & Programming insights — scaling skills from learning foundations to enterprise-grade solutions.
Hue function in Wolfram Mathematica: A guide to color representation
›Forums›Wolfram Language›Hue function in Wolfram Mathematica: A guide to color representation
Disclaimer: This article was created with the assistance of an AI language model and is intended for informational purposes only. Please verify any technical details before implementation.
In Wolfram Mathematica, Hue is a function used to define colors based on the hue-saturation-brightness (HSB) color model.
The basic syntax is:
Hue[h]
Here, h represents the hue value, which is a number between 0 and 1. The value 0 corresponds to red, 1/3 to green, 2/3 to blue, and 1 wraps around to red again.
You can also specify saturation and brightness with:
Hue[h, s, b]
h is the hue (color type)
s is the saturation (0 = grayscale, 1 = full color)
b is the brightness (0 = black, 1 = full brightness)
Finally, you can add an optional fourth parameter for opacity:
Hue[h, s, b, a]
where a is the opacity (0 = fully transparent, 1 = fully opaque).
Examples:
Red color:
Graphics[{Hue[0], Disk[]}]
Green with full brightness and half saturation:
Graphics[{Hue[1/3, 0.5, 1], Disk[]}]
Blue with 50% opacity:
Graphics[{Hue[2/3, 1, 1, 0.5], Disk[]}]
Hue values can be used in 2D and 3D graphics to apply colors to shapes, surfaces, and plots.