'Pyautogui not showing correct pixel color on Mac

I am trying to get the pixel color of where the mouse is, and the RGB value is not even close to what it is supposed to be. Here is an example. I am using some basic code:

import pyautogui
import time

while True:
     x, y = pyautogui.position()
     print(pyautogui.pixel(x, y))
     time.sleep(1)

I have no clue what to do and any advice would be appreciated!



Solution 1:[1]

We conclude that the code works fine on a windows 10 with vscode and python 3.10.

It appears as though this is might be a Mac specific issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 D.L