Change text color based on background color of an element while scrolling

I'm trying to change the color of a black text to white when the element is over a section with a black background color, and I want it to work everytime a black background is in my page, so I think it should be based on scroll ? I've tried some things with jQuery but it only work if there is only one black background section in my page..

To illustrate what I'm saying, I want something exactly like that : https://www.uber.design/case-studies/driver-app The thing I'm speaking about is the little "menu" that appears on the left when you scroll a bit in the page. When it goes over a black background, the text automatically become white, and conversely.

I've tried to be as clear as possible, I hope you'll understand what I'm looking to achieve.

Thank's in advance.