Methods Metrics and Formulae

Html, Hexadecimal & RGB values of primary colors
RED FF0000 → R = 255 G = 0 B = 0
GREEN 00FF00 → R = 0 G = 255 B = 0
BLUE 0000FF → R = 0 G = 0 B = 255

Metrics and Formulae

How to calculate a final Chromatic Unit Value (aka Grade/Mark) based on combination of three colors Red, Green and Blue?

The first formula of importance is to apply a maximum Chromatic Unit Values (CUV) formula to determine which of the three Chromatic Unit Values (CUV) is the highest. In this example, Chromatic Unit Values (CUV are entered into the cells C13, C14, and C15 and expressed as a range in cell C16:

From there, we can then calculate a percentage based on the highest Chromatic Unit Values (CUV) being equal to 100%, and which corresponding percentage will be given for each individual Chromatic Unit Value (CUV) “Red, Green, and Blue” (respectively in C13, C14, C15) into cells D13, D14, and D15:

Once the percentage of each Chromatic Unit Value (CUV) based on the highest value being equal to 100% calculated, we then need to convert this trinome of Chromatic Unit Values (CUV) into a trinome of individual RGB coordinates (r,g,b) that is Red, Green and Blue. in cells E13, E14, and E15 and round down each result knowing that the RGB coordinate maximum value is 255 (so 100%=255):
E13=ROUNDDOWN(255*D13/100, 0)
E14=ROUNDDOWN(255*D14/100, 0)
E15=ROUNDDOWN(255*D15/100, 0)

Then, RGB coordinates need to be converted into one single Hexadecimal value (in another word, Html color number) expressed as a single result into cell D7:

Last, using VBA on Excel or javascript on other programmes , each Hex value convert the next cell’s background into an Html color like #00FF00 for Green for instance


Javascript convert hex values intor colored background


Convert Hex values into background color excel

Leave a Comment

Your email address will not be published. Required fields are marked *