Getting Color of certain pixel on screen lazarus / 39-Graphics ---------------------------------------------------------------------- dietmar · 2021-07-22 17:06 Hi, I want a) to determine the current background color value of a form b) to determine the color (RGB, TColor) of a certain point on the screen. Can you help? Thx Dietmar ---------------------------------------------------------------------- winni · 2021-07-22 19:17 Hi! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  ScreenDC: HDC;  RGB, BGcol : TColor; begin    // a)   BGcol := Form1.Color;    // b) get color of pixel  10/20  ScreenDC := GetDC(0);  RGB := GetPixel(ScreenDC 10, 20);  end; Winni ---------------------------------------------------------------------- 440bx · 2021-07-22 19:27 Quote from: dietmar on July 22, 2021, 07:06:57 pmI want a) to determine the current background color value of a form b) to determine the color (RGB, TColor) of a certain point on the screen. I can only tell you how to do it using the Windows API.  For a multiplatform answer, someone else will have to provide it. for (a) use GetClassLongPtr using GCL_HBRBACKGROUND for (b) use GetPixel both of those functions are documented by MS.  Use Google to get to the detailed documentation. HTH. ---------------------------------------------------------------------- wp · 2021-07-22 20:48 The following code is taken from the mbColorLib package and is cross- platform: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function ReadScreenColor(const X, Y: integer): TColor;var  ScreenDC: HDC;  SaveBitmap: TBitmap;begin  SaveBitmap := TBitmap.Create;  try    SaveBitmap.SetSize(Screen.Width, Screen.Height);    ScreenDC := GetDC(0);    try      SaveBitmap.LoadFromDevice(ScreenDC);    finally      ReleaseDC(0, ScreenDC);    end;    Result := SaveBitmap.Canvas.Pixels[X, Y];  finally    SaveBitmap.Free;  end;end; ---------------------------------------------------------------------- winni · 2021-07-22 20:52 Hi! Yes, that is the long version for a HowTo-Book. I showed the short version above. Winni ---------------------------------------------------------------------- dietmar · 2021-07-22 20:55 Thank you all! Dietmar ---------------------------------------------------------------------- wp · 2021-07-22 20:57 Quote from: winni on July 22, 2021, 10:52:02 pmI showed the short version above. To my knowledge GetPixel is a function in the Windows unit. If it were cross-platform, it would be found in LCLIntf.