Converting a decimal color value (24-bit) to RGB in Delphi is easy using bitshifts, the reverse is true as well. Here’s how it’s done:
procedure ColorToRGB(const Color: Integer; out R, G, B: Byte); begin R := Color and $FF; G := (Color shr 8) and $FF; B := (Color shr 16) and $FF; end; function RGBToColor(const R, G, B: Byte): Integer; begin Result := R or (G shl 8) or (B shl 16); end;
Take in mind that Delphi TColor is a 24-bit integer decimal color representation.