function DesktopColor(const x,y: integer): TColor;
var
c:TCanvas;
begin
c:=TCanvas.create;
c.handle:=GetWindowDC(GetDesktopWindow);
result:=getpixel(c.handle,x,y);
c.free;
end;
function ColorToHTMLHex(Color: TColor): String;
begin
Result := IntToHex(ColorToRGB(Color), 6);
Result := Copy(Result, 5, 2) + Copy(Result, 3, 2) + Copy(Result, 1, 2);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
pos: TPoint;
begin
GetCursorPos(Pos);
Panel1.Color:=DesktopColor(pos.x, pos.y);
Panel1.Caption:='$'+ColorToHTMLHex(Panel1.Color);
end;