Darker
Details
- Darker can be used to create a darker version of a color or an image.
- Darker[color,1] gives black. »
- Darker[color,0] gives color. »
- Darker[color] is equivalent to Darker[color,1/3]. »
- Darker[color,f] for values of f outside the range 0 to 1 is clipped.
- Darker[image] works with 2D as well as 3D images.
- Darker[{col1,col2,…},…] gives darker versions of each of the coli. »
- When applied to color, Darker always returns an RGBColor.
- When applied to color images, Darker always returns an RGB image.
- Darker does not affect the opacity of a color or an image.
Examples
open all close allBasic Examples (3)
Graphics[{Darker[Red], Disk[]}]Graphics3D[{Darker[Green], Sphere[]}]Specify how much the color should be darkened by using a fraction:
Graphics[{Darker[Blue, #], Disk[]}]& /@ {.1, .5, .8}Darker[[image], .5]Scope (9)
Data (6)
Darker version of a color:
Darker[RGBColor[1, 0, 0]]Darker version of a 2D grayscale image:
Darker[[image]]Darker[[image]]Darker[\!\(\*VideoBox[""]\)]Darker[[image]]Darker automatically threads over colors:
Darker[{Red, Green, Blue}, 1 / 2]Parameters (3)
The default darkening fraction is
:
Darker[Red] == Darker[Red, 1 / 3]{Graphics[{Darker[Red], Disk[]}], Graphics[{Darker[Red, 1 / 3], Disk[]}]}Specify different darkening fractions:
Table[Graphics[{Darker[Red, i], Disk[]}], {i, {0.2, 0.4, 0.6, 0.8}}]With a darkening fraction of zero, the color is unchanged:
Darker[Blue, 0] == Blue{Graphics[{Darker[Blue, 0], Disk[]}], Graphics[{Blue, Disk[]}]}With a darkening fraction of one, the color becomes black:
Darker[Blue, 1] == RGBColor[0, 0, 0]{Graphics[{Darker[Blue, 1], Disk[]}], Graphics[{Black, Disk[]}]}Applications (3)
Use Darker to construct ColorFunction for plots:
Plot3D[y Sin[x ^ 2 + y ^ 2], {x, -3, 3}, {y, -3, 3}, ColorFunction -> (Darker[Cyan, #3]&), Mesh -> None, PlotPoints -> 40]DensityPlot[Sin[x]Sin[y], {x, -4, 4}, {y, -4, 4}, ColorFunction -> (Darker[Cyan, #]&)]Use Darker and Lighter values of a particular hue as a color function:
ContourPlot[Sin[x]Sin[y], {x, 0, 2Pi}, {y, 0, 2Pi}, ColorFunction -> (If[# < 0, Darker[Blue, Abs[#]], Lighter[Red, #]]&), ColorFunctionScaling -> False]Detect the face in an image and highlight it by darkening the background:
i = [image];
{w, h} = ImageDimensions[i];mask = Graphics[FindFaces[i], PlotRange -> {{0, w}, {0, h}}];Combine the darkened background with the original:
bg = SetAlphaChannel[Darker[i, .55], mask];
ImageCompose[i, bg]Properties & Relations (5)
Darker of a color is always returned as an RGBColor:
Darker[CMYKColor[0, 1, 1, 0]]//InputFormThe opacity value is unaffected by Darker:
Darker[RGBColor[1, 0, 0, .4]]//InputFormDarker is a special case of Blend:
{Darker[Blue, 1 / 2], Blend[{Blue, Black}, 1 / 2]}//InputForm{Graphics[{Darker[Blue, 1 / 2], Disk[]}], Graphics[{Blend[{Blue, Black}, 1 / 2], Disk[]}]}Darker and Lighter are not commutative:
Lighter[Darker[Red, .5], .5]Darker[Lighter[Red, .5], .5]Darker for images is a special case of ImageAdjust or Blend:
{Darker[[image], 0.5], ImageAdjust[[image], {0, -0.5}], Blend[{[image], Black}, 0.5]}Possible Issues (2)
Values outside of the 0, 1 range will be clipped:
Graphics[Table[{Darker[Red, i], EdgeForm[Opacity[.1]], Disk[{5i, 0}]}, {i, 0 - 1 / 4, 1 + 1 / 4, 1 / 4}]]Some colors may look greenish during the darkening:
Graphics[Table[{Darker[Yellow, i], EdgeForm[Opacity[.1]], Disk[{7i, 0}]}, {i, 0, 1, 1 / 6}]]Interactive Examples (1)
See Also
Lighter Blend GrayLevel ColorSlider ImageAdjust LightDarkSwitched
Function Repository: DeeperColor
History
Introduced in 2007 (6.0) | Updated in 2012 (9.0) ▪ 2014 (10.0) ▪ 2021 (13.0)
Text
Wolfram Research (2007), Darker, Wolfram Language function, https://reference.wolfram.com/language/ref/Darker.html (updated 2021).
CMS
Wolfram Language. 2007. "Darker." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Darker.html.
APA
Wolfram Language. (2007). Darker. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Darker.html
BibTeX
@misc{reference.wolfram_2026_darker, author="Wolfram Research", title="{Darker}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/Darker.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_darker, organization={Wolfram Research}, title={Darker}, year={2021}, url={https://reference.wolfram.com/language/ref/Darker.html}, note=[Accessed: 13-June-2026]}