FindMatchingColor[image,color]
returns a color similar to the color that is present in image.
FindMatchingColor[image,{color1,color2,…}]
returns a list of colors matching each colori.
FindMatchingColor[{image1,image2,…},{color1,color2,…}]
returns lists of matching colors for all imagei.
FindMatchingColor
FindMatchingColor[image,color]
returns a color similar to the color that is present in image.
FindMatchingColor[image,{color1,color2,…}]
returns a list of colors matching each colori.
FindMatchingColor[{image1,image2,…},{color1,color2,…}]
returns lists of matching colors for all imagei.
Details and Options
- FindMatchingColor takes the dominant colors of the image and returns a color it finds close to color. It is typically used for finding the shade of a color present in an image.
- If no color similar to color is available in image, a Missing object is returned.
- The following options can be given:
-
ColorCoverage Automatic fraction of the image covered by a color similar to color DistanceFunction Automatic any distance supported in ColorDistance MaxColorDistance Automatic maximum color distance MinColorDistance Automatic minimum distance used by DominantColors - FindMatchingColor[{col1,col2,…},color] is also supported.
Examples
open all close allBasic Examples (2)
Find a color similar to pink in the image:
FindMatchingColor[[image], Pink]The image does not have a color similar to green:
FindMatchingColor[[image], Green]Find a color similar to pink from a list of colors:
FindMatchingColor[{RGBColor[0.9596025905785178, 0.3984044792339911, 0.41392466016763657], RGBColor[0.28324476057075976, 0.26097834139620046, 0.27130742463122076], RGBColor[0.05826288145041437, 0.053591610965247304, 0.06190272775838334], RGBColor[0.4757177856709867, 0.47140005577751737, 0.4837801597898334], RGBColor[0.606719111118272, 0.20611757291882038, 0.20631494426934727], RGBColor[0.5710576308076775, 0.6028166494876642, 0.7367693265717367]}, Pink]Scope (4)
Find a color similar to pink in an image:
FindMatchingColor[[image], Pink]Look for multiple similarities:
FindMatchingColor[[image], {Pink, Black}]Find a similar color in multiple images:
FindMatchingColor[{[image], [image]}, Pink]Find a similar color within an explicit color list:
FindMatchingColor[{RGBColor[0.054590418020939606, 0.03659334670402592, 0.013858479733606759], RGBColor[0.7305489880573857, 0.12659171642925934, 0.01432816539899081], RGBColor[0.5155491678578256, 0.020429470376645973, 0.005741067913385457], RGBColor[0.9868808615574666, 0.5491236792401024, 0.41542833669450197], RGBColor[0.5487085713979556, 0.46487049927166074, 0.3900532282021348], RGBColor[0.6072585025121294, 0.28001172180255307, 0.3028226636244236]}, Pink]FindMatchingColor[{RGBColor[0.054590418020939606, 0.03659334670402592, 0.013858479733606759], RGBColor[0.7305489880573857, 0.12659171642925934, 0.01432816539899081], RGBColor[0.5155491678578256, 0.020429470376645973, 0.005741067913385457], RGBColor[0.9868808615574666, 0.5491236792401024, 0.41542833669450197], RGBColor[0.5487085713979556, 0.46487049927166074, 0.3900532282021348], RGBColor[0.6072585025121294, 0.28001172180255307, 0.3028226636244236]}, {Pink, Gray}]Options (3)
ColorCoverage (1)
By default, an automatic minimum color coverage is used:
img = [image];FindMatchingColor[img, {White, Red}]Require a minimum coverage level:
FindMatchingColor[img, {White, Red}, ColorCoverage -> .2]FindMatchingColor[img, {White, Red}, ColorCoverage -> {0, .1}]DistanceFunction (1)
By default, a perceptual color distance is used:
img = [image];c1 = FindMatchingColor[img, Blue]Use DistanceFunction to specify a different distance metric:
c2 = FindMatchingColor[img, Blue, DistanceFunction -> "DeltaL"]The new match has a closer luminance to the reference:
ColorConvert[{Blue, c1, c2}, "LAB"][[All, 1]]MaxColorDistance (1)
By default, only colors close to the target color are returned:
img = [image];FindMatchingColor[img, {Cyan, Blue}]Use MaxColorDistance to specify a custom threshold:
FindMatchingColor[img, {Cyan, Blue}, MaxColorDistance -> 1]Use MaxColorDistanceInfinity to find the closest color:
FindMatchingColor[img, White, MaxColorDistance -> Infinity]Applications (3)
Perform a foreground-background segmentation based on the color of the background:
i = [image];Binarize[ColorDistance[i, Blue]]The image seems to contain blue, but the actual pixel values are very far from it:
Min@ColorDistance[i, Blue]Find the matching blue in the image and use it to perform the segmentation:
c = FindMatchingColor[i, Blue, MaxColorDistance -> 1]Binarize[ColorDistance[i, c]]Transform a color palette using colors from a natural image:
image = [image];
palette = {GrayLevel[0], RGBColor[0.24, 0.59, 0.8300000000000001], RGBColor[0.6, 0.4, 0.2], RGBColor[0., 0.30000000000000004, 0.], RGBColor[1/3, 1, 1/3], GrayLevel[1]};FindMatchingColor[image, palette, MaxColorDistance -> Infinity]Select images based on the presence of a color:
images = {[image], [image], [image], [image]};Find images with yellow objects:
DeleteMissing[Transpose[{images, FindMatchingColor[images, RGBColor[1, 0.81, 0]]}], 1, 2][[All, 1]]Find images with yellow and red objects:
DeleteMissing[Transpose[{images, FindMatchingColor[images, {RGBColor[1, 0, 0], RGBColor[1, 0.81, 0]}]}], 1, 2][[All, 1]]Find images with red and green objects:
DeleteMissing[Transpose[{images, FindMatchingColor[images, {RGBColor[1, 0, 0], RGBColor[0, 0.64, 0.22]}]}], 1, 2][[All, 1]]Related Guides
History
Text
Wolfram Research (2019), FindMatchingColor, Wolfram Language function, https://reference.wolfram.com/language/ref/FindMatchingColor.html.
CMS
Wolfram Language. 2019. "FindMatchingColor." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FindMatchingColor.html.
APA
Wolfram Language. (2019). FindMatchingColor. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindMatchingColor.html
BibTeX
@misc{reference.wolfram_2026_findmatchingcolor, author="Wolfram Research", title="{FindMatchingColor}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/FindMatchingColor.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_findmatchingcolor, organization={Wolfram Research}, title={FindMatchingColor}, year={2019}, url={https://reference.wolfram.com/language/ref/FindMatchingColor.html}, note=[Accessed: 13-June-2026]}