Color Difference Using CIE76

Chequered Ink Ltd

You must be logged in to obtain assets


Check the difference (or similarity) between two colors in your game using the CIE76 formula.

This script checks two color values (provided as arguments in standard GM format) and returns the color difference as a numerical value. The closer to zero the value is, the more alike the colors are.

How does it work?

The script is used as follows:

colors_compare_cie76( color_one, color_two );

The script gets the RGB values of the two colors and converts them to XYZ values and then to Lab values. Then, the CIE76 formula is used to find the value of Delta-E, the difference between the two colors.

You can find out more about the CIE76 formula here: Wikipedia

Why is this useful?

There are many different applications of this script that could be useful. You could use the returned value to check how well your character blends into the background of your level (for stealth games) or you could use it to create a "green screen" effect. You could also use this value to make your games more friendly to users with vision problems. Let your imagination run wild?

Is it 100% foolproof?

Unfortunately, no. Mathematically calculating the similarity between two colors is no substitute for a healthy human eye. CIE76 isn't the newest formula for this kind of thing either. You may notice various areas where more similar colors, as perceived by our eyes, are given an 'odd' rating by the formula. This is unfortunately unavoidable - although we will be looking into using more recent forumlas, like CIE94 or CIE2000 to improve this asset and others in future.


We have created a new asset for comparing colors using CIE94. Check it out here.

More info

End User Licence Agreement (EULA).

Age Rating: 4+


GMS1 - Version 1.0.0. Published June 29, 2015

Privacy Policy
Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait