devxlogo

Determing RGB values

Determing RGB values

Question:
Is there an easy way of determining the RGB values when you have the long value of a color (for example, a “reverse” RGB(x,y,z) function)?

Answer:
You can make use of the Mod function to convert a long back into its Red, Green and Blue values. For example:

li_Red = int( mod( ll_LongCol, 256 ) )li_Green = int( mod( ll_LongCol / 256, 256 ) )li_Blue = ll_LongCol / ( 256 * 256 )
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist