Browser don't support replacing cursor images natively for obvious reasons. You have to use JavaScript for that.
The background colour of the hovered element is known. When you specify the bgcolor, also override the cursor image.
For normal elements this can be done with mix-blend-mode, but that's not available for the cursor.