Is there a way to reliably get if LibreOffice is using a Dark Theme or a Light Theme when Set to System?

Is there a way to reliably get if LibreOffice is using a Dark Theme or a Light Theme when Set to System?

I have done a little testing and It seems LibreOffice is not detecting System Colors on Linux in some cases.

In my testing on Ubuntu 24.04 LibreOffice Fails to detect System Theme When LibreOffice is installed with Apt.
Also fails with Flatpak installed version.
Works with Snap installed version.

I also tested on Ubuntu 20.04 and LibreOffice 24.2 installed from the deb package downloaded from LibreOffice website.
I works just fine, as expected.

I my testing I have found that when LibreOffice fails to detect system theme it defaults to Dark colors.
So, if the system is set to Light colors, LibreOffice apt installed and FlatPak installed start using Dark colors.

I have a use case where I need to create a GUI window using kivy in python that is to be used in LibreOffice.
I want the GUI window to match the colors of LibreOffice and the current theme.

When LibreOffice is set to dark or light themes I can get the colors from LibreOffice via configuration and a combination of Default Dark or Light colors.

When LibreOffice is using System Theme I have no way on knowing if LibreOffice is using Dark or Light theme.
I can use a package such as darkdetect to discover if the system is using Dark or Light.
The issue is when LibreOffice is not reporting correctly, then the system may be set to Light but LibreOffice may being using Dark even though it is set to System Theme.

So, is there a way that I can access the actual colors that LibreOffice is using, perhaps even the document background color or something that could give me a hint if the actual colors being used are dark or light?

See Also Dark | Light | System? Can I access if System Color is in Dark Or Light Mode via LibreOffice API?

I figure it out. Document current controller has CurrentController.ComponentWindow.StyleSettings.LightColor which takes on a different color when the System theme changes.

See Is_document_dark() in OooDev Source.