Dark mode with Rich Document Content TextView in Swift 5

I am working on a MacOS app that supports dark mode. It has a Rich Document content TextView that loads a rtf document and saves it back. I am trying to support Dark mode in this textview. I have tried adding

textview.usesAdaptiveColorMappingForDarkAppearance = true

with the default colors but see black text on a white background.

I have see TextEdit do this wonderfully where it is able to load the same rtf with a black background and white text in dark mode.

Can somebody help me to give insight into how to change the default color to white on black in dark mode and black on white in light mode.

Thank you!