How to consume Plasmic global variants in own code?

I am trying to register components that are aware of the light|dark theme defined by the PlasmicGlobalVariant theme provider.
How can I make my own components aware of Plasmic’s theme provider? Is there any example code somewhere?

I think I might have found it! :slightly_smiling_face:

image.png

it’s not working, though. theme is aways dark

Is it happening because Plasmic Studio is loading the context from my local host instead of hosting a context on its own? If so, how can that be fixed?

Sorry! Currently there’s not a way to consume the global variants in studio artboard from code-components.
We don’t use React.Context for the global variants in the artboards :smiling_face_with_tear:

We’re going to think how we can support this use case!

isn’t the file from globalContextsFilePath able to fix that?

Yeah, that’s generated code and it exists in isolation of what’s running within the Studio - we’re still thinking about how to allow this to work more seamlessly like you mention, but it isn’t supported today

Thank you both for the assistance. Really appreciated!