Is it possible to be alerted about a Windows registry change?

Is there a way (declares are fine, I don’t want to use a plugin as this is an open source project) to be alerted by Windows when a particular registry item is altered?

At the moment, I am periodically polling the value of a particular registry key to see if the user prefers a light or dark theme for their apps but I was wondering if there is anyway to be notified by the OS of a change to a particular registry entry.

I did it 20 years ago and I cant recall how. LOL

Maybe is this: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regnotifychangekeyvalue