Science, Tech, Math › Computer Science How to Get More RBG Color Values for Delphi Expand your color range by converting RBG to TColor Share Flipboard Email Print MirageC/Getty Images Computer Science Delphi Programming Delphi Tutorials Advanced PHP Programming Perl Python Java Programming Javascript Programming C & C++ Programming Ruby Programming Visual Basic View More By Zarko Gajic Zarko Gajic Twitter Computer Science Expert MSCS, Computer Science, University of Osijek Zarko Gajic is experienced in SQL and has working knowledge of DB systems such as MS SQL Server, Firebird, Interbase, and Oracle. He is also proficient in XML, DHTML, and JavaScript. Learn about our Editorial Process Updated on October 02, 2018 In Delphi, the TColor type specifies the color of an object. It is used by the color property of many components and by other properties that specify color values. The Graphics unit contains definitions of useful constants for TColor. For example, clBlue maps to blue, clRed maps to red. More "CL" Values = More Colors You can specify TColor as a 4-byte hexadecimal number instead of using the constants defined in the Graphics unit. The low three bytes represent RGB (red, green, blue) color intensities for blue, green and red, respectively. Note the inversion from a typical hex color: For TColor, the sequence is blue-green-red. For example, red can be defined as TColor($0000FF). Convert RBG to TColor If you have values for red, green and blue intensities (a number from 0 to 255 - "byte" type), here's how to get the TColor value: var r,g,b : Byte; color : TColor; begin r := StrToInt(ledRed.Text) ; g := StrToInt(ledGreen.Text) ; b := StrToInt(ledBlue.Text) ; color := RGB(r, g, b) ; Shape1.Brush.Color := color; end; The "ledRed", "ledGreen" and "ledBlue" are three edit controls used to specify the intensity of each color component. Shape1 is a TShape Delphi control. Delphi tips navigator:» How to Parse TAB Delimited Files in Delphi« IsDirectoryEmpty - Delphi function to Determine if a Directory is Empty (no files, no sub-folders) Cite this Article Format mla apa chicago Your Citation Gajic, Zarko. "How to Get More RBG Color Values for Delphi." ThoughtCo, Aug. 28, 2020, thoughtco.com/convert-rgb-to-tcolor-1057628. Gajic, Zarko. (2020, August 28). How to Get More RBG Color Values for Delphi. Retrieved from https://www.thoughtco.com/convert-rgb-to-tcolor-1057628 Gajic, Zarko. "How to Get More RBG Color Values for Delphi." ThoughtCo. https://www.thoughtco.com/convert-rgb-to-tcolor-1057628 (accessed March 22, 2023). copy citation Featured Video