Color gradient

Last updated

A linear, or axial, color gradient Linear-gradient.svg
A linear, or axial, color gradient

In color science, a color gradient (also known as a color ramp or a color progression) specifies a range of position-dependent colors, usually used to fill a region.

Contents

In assigning colors to a set of values, a gradient is a continuous colormap, a type of color scheme. In computer graphics, the term swatch [1] has come to mean a palette of active colors.

Definitions

Strict definition

A colormap [4] is a function which associate a real value r with point c in color space

which is defined by:

where:

Types

Criteria for classification:

Dimension

Shapes

Axial gradients

An axial color gradient, with a white line segment connecting the two points Gradient.svg
An axial color gradient, with a white line segment connecting the two points

An axial color gradient (sometimes also called a linear color gradient) is specified by two points, and a color at each point. The colors along the line through those points are calculated using linear interpolation, then extended perpendicular to that line. In digital imaging systems, colors are typically interpolated in an RGB color space, often using gamma compressed RGB color values, as opposed to linear. CSS and SVG both support linear gradients. [8] [9]

Radial gradients

A radial color gradient Radial-gradient.svg
A radial color gradient

A radial gradient is specified as a circle that has one color at the edge and another at the center. Colors are calculated by linear interpolation based on distance from the center. This can be used to approximate the diffuse reflection of light from a point source by a sphere.[ citation needed ] Both CSS and SVG support radial gradients. [10] [11]

Conic gradients

conic gradient 20151204-IMG 2634BlauGelb.jpg
conic gradient

Conic or conical gradients are gradients with color transitions rotated around a center point (rather than radiating from the center). Example conic gradients include pie charts and color wheels. [12] Conic gradients are sometimes called "sweep gradients" (for example in the OpenType specification) or angular gradients.

Other shapes

In vector graphics polygon meshes can be used, e.g., Adobe Illustrator supported gradient meshes.

Color space

Effect of color space

The appearance of a gradient not only varies by the color themselves, but also by the color space the calculation is performed in. The problem usually becomes important for two reasons:

  • Gamma correction to a color space. With a typical γ of around 2, it is easy to see that a gamma-enabled color space will blend darker than a linear-intensity color space, since the sum of squares of two numbers is never more than the square of their sum. The effect is most apparent in blending complementary colors like red and green, with the middle color being a dark color instead of the expected yellow. [13] [14] The radial and conic examples on this page clearly exhibit this error.
  • Handling of other perceptual properties. In information visualization, it is undesirable to have a supposedly "flat" gradient show non-monotonic variations in lightness and saturation along the way. This is because human vision emphasizes these qualities, causing bias or confusion in interpretation. [15]

A "linear" blend would match physical light blending and has been the standard in game engines for a long time. [16] On the web, however, it has long been neglected for both color gradients and image scaling. [17] Such a blend still has a subtle difference from one done in a perceptually-uniform color space. [18]

Examples

HSV rainbow

Applications

See also

Related Research Articles

<span class="mw-page-title-main">Alpha compositing</span> Operation in computer graphics

In computer graphics, alpha compositing or alpha blending is the process of combining one image with a background to create the appearance of partial or full transparency. It is often useful to render picture elements (pixels) in separate passes or layers and then combine the resulting 2D images into a single, final image called the composite. Compositing is used extensively in film when combining computer-rendered image elements with live footage. Alpha blending is also used in 2D computer graphics to put rasterized foreground elements over a background.

<span class="mw-page-title-main">Hue</span> Property of a color

In color theory, hue is one of the main properties of a color, defined technically in the CIECAM02 model as "the degree to which a stimulus can be described as similar to or different from stimuli that are described as red, orange, yellow, green, blue, violet," within certain theories of color vision.

Gamma correction or gamma is a nonlinear operation used to encode and decode luminance or tristimulus values in video or still image systems. Gamma correction is, in the simplest cases, defined by the following power-law expression:

<span class="mw-page-title-main">HSL and HSV</span> Alternative representations of the RGB color model

HSL and HSV are the two most common cylindrical-coordinate representations of points in an RGB color model. The two representations rearrange the geometry of RGB in an attempt to be more intuitive and perceptually relevant than the cartesian (cube) representation. Developed in the 1970s for computer graphics applications, HSL and HSV are used today in color pickers, in image editing software, and less commonly in image analysis and computer vision.

In computing, on the X Window System, X11 color names are represented in a simple text file, which maps certain strings to RGB color values. It was traditionally shipped with every X11 installation, hence the name, and is usually located in <X11root>/lib/X11/rgb.txt. The web colors list is descended from it but differs for certain color names.

Web colors are colors used in displaying web pages on the World Wide Web; they can be described by way of three methods: a color may be specified as an RGB triplet, in hexadecimal format or according to its common English name in some cases. A color tool or other graphics software is often used to generate color values. In some uses, hexadecimal color codes are specified with notation using a leading number sign (#). A color is specified according to the intensity of its red, green and blue components, each represented by eight bits. Thus, there are 24 bits used to specify a web color within the sRGB gamut, and 16,777,216 colors that may be so specified.

<span class="mw-page-title-main">CIELAB color space</span> Standard color space with color-opponent values

The CIELAB color space, also referred to as L*a*b*, is a color space defined by the International Commission on Illumination in 1976. It expresses color as three values: L* for perceptual lightness and a* and b* for the four unique colors of human vision: red, green, blue and yellow. CIELAB was intended as a perceptually uniform space, where a given numerical change corresponds to a similar perceived change in color. While the LAB space is not truly perceptually uniform, it nevertheless is useful in industry for detecting small differences in color.

<span class="mw-page-title-main">Grayscale</span> Image where each pixels intensity is shown only achromatic values of black, gray, and white

In digital photography, computer-generated imagery, and colorimetry, a grayscale image is one in which the value of each pixel is a single sample representing only an amount of light; that is, it carries only intensity information. Grayscale images, a kind of black-and-white or gray monochrome, are composed exclusively of shades of gray. The contrast ranges from black at the weakest intensity to white at the strongest.

sRGB Standard RGB color space

sRGB is a standard RGB color space that HP and Microsoft created cooperatively in 1996 to use on monitors, printers, and the World Wide Web. It was subsequently standardized by the International Electrotechnical Commission (IEC) as IEC 61966-2-1:1999. sRGB is the current defined standard colorspace for the web, and it is usually the assumed colorspace for images that are neither tagged for a colorspace nor have an embedded color profile.

<span class="mw-page-title-main">Eccentricity (mathematics)</span> Characteristic of conic sections

In mathematics, the eccentricity of a conic section is a non-negative real number that uniquely characterizes its shape.

Relative luminance follows the photometric definition of luminance including spectral weighting for human vision, but while luminance is a measure of light in units such as , relative luminance values are normalized as 0.0 to 1.0, with 1.0 being a theoretical perfect reflector of 100% reference white. Like the photometric definition, it is related to the luminous flux density in a particular direction, which is radiant flux density weighted by the luminous efficiency function of the CIE Standard Observer.

<span class="mw-page-title-main">Color picker</span> Graphical user interface element

A color picker is a graphical user interface widget, usually found within graphics software or online, used to select colors and, in some cases, to create color schemes. Operating systems such as Microsoft Windows or macOS have a system color picker, which can be used by third-party programs.

<span class="mw-page-title-main">Blend modes</span> How two or more digital photo layers are mixed together

Blend modes in digital image editing and computer graphics are used to determine how two layers are blended with each other. The default blend mode in most applications is simply to obscure the lower layer by covering it with whatever is present in the top layer ; because each pixel has numerical values, there also are many other ways to blend two layers.

<span class="mw-page-title-main">Color space</span> Standard that defines a specific range of colors

A color space is a specific organization of colors. In combination with color profiling supported by various physical devices, it supports reproducible representations of color – whether such representation entails an analog or a digital representation. A color space may be arbitrary, i.e. with physically realized colors assigned to a set of physical color swatches with corresponding assigned color names, or structured with mathematical rigor. A "color space" is a useful conceptual tool for understanding the color capabilities of a particular device or digital file. When trying to reproduce color on another device, color spaces can show whether shadow/highlight detail and color saturation can be retained, and by how much either will be compromised.

<span class="mw-page-title-main">Shades of violet</span> Varieties of the color violet

Violet is a color term derived from the flower of the same name. There are numerous variations of the color violet, a sampling of which are shown below.

<span class="mw-page-title-main">HCL color space</span> Color space model

HCL (Hue-Chroma-Luminance) or LCh refers to any of the many cylindrical color space models that are designed to accord with human perception of color with the three parameters. Lch has been adopted by information visualization practitioners to present data without the bias implicit in using varying saturation. They are, in general, designed to have characteristics of both cylindrical translations of the RGB color space, such as HSL and HSV, and the L*a*b* color space. Some conflicting definitions of the terms are:

References

  1. cssgradient: CSS Gradient Swatches
  2. Dave Green's 'cubehelix' colour scheme
  3. Diverging Color Maps for Scientific Visualization - Kenneth Moreland
  4. The Good, the Bad, and the Ugly: A Theoretical Framework for the Assessment of Continuous Colormaps by Roxana Bujack, Terece L. Turton, Francesca Samsel, Colin Ware
  5. which-color-scale-to-use-in-data-vis by Lisa Charlotte Rost
  6. Fabio Crameri: Scientific colour maps
  7. A survey and task-based quality assessment of static 2D colormaps Author(s): Bernard, Jürgen; Steiger, Martin; Mittelstädt, Sebastian; Thum, Simon; Keim, Daniel; Kohlhammer, Jörn, In Kao, David L. (Ed.) ; Society for Imaging Science and Technology -IS&T-; Society of Photo-Optical Instrumentation Engineers -SPIE-, Bellingham/Wash.: Visualization and Data Analysis 2015 : 9–11 February 2015, San Francisco, California Bellingham, WA: SPIE, 2015 (Proceedings of SPIE 9397) ISBN   9781628414875
  8. Linear Gradients in "CSS Image Values and Replaced Content Module Level 3", W3C Candidate Recommendation, April 2012
  9. Linear Gradients in "SVG 1.1 (Second Edition)", W3C Recommendation, August 2011
  10. Radial Gradients in "CSS Image Values and Replaced Content Module Level 3", W3C Candidate Recommendation, April 2012
  11. Radial Gradients in "SVG 1.1 (Second Edition)", W3C Recommendation, August 2011
  12. mozilla docs: CSS conic-gradient
  13. Minute Physics (March 20, 2015). "Computer Color is Broken". YouTube . Archived from the original on December 21, 2021.
  14. Novak, John (September 21, 2016). "What every coder should know about gamma".
  15. Zeileis, Achim; Fisher, Jason C.; Hornik, Kurt; Ihaka, Ross; McWhite, Claire D.; Murrell, Paul; Stauffer, Reto; Wilke, Claus O. (2019). "colorspace: A Toolbox for Manipulating and Assessing Colors and Palettes". Journal of Statistical Software. 96. arXiv: 1903.06490 . doi:10.18637/jss.v096.i01.
  16. "Chapter 24. The Importance of Being Linear". NVIDIA Developer.
  17. "Web color is still broken".
  18. "How software gets color wrong". bottosson.github.io. December 3, 2020.
  19. gnuplot docs 4.2 node167: Color box [ permanent dead link ]
  20. Eisenberg, J. David (2002). SVG Essentials . O'Reilly Media. p.  107. ISBN   0-596-00223-8.