Unable to register color token inside PlasmicComponent

Hello, I was wondering would it be possible to register a color token via plasmic.registerToken() inside the <PlasmicComponent /> ? For token registration I am using color data stored in an object which comes from studio’s global context (component registered via registerGlobalContext). That is why I have to register tokens inside of the plasmic components, else I won’t be able to get the color object from global context. I have tried to register it inside <plasmicComponent /> but nothing happens, and no error is thrown. So I started to think - is it even possible?

Hi Dominykas, what do you mean by calling registerToken inside <PlasmicComponent/> ? ideally we would expect that the plasmic host is a stable page with the set of registered content, so dynamically registration it’s expected to work.

Hey, thank you for the reply. I’ll rephrase, what I meant to ask was - is it possible to call plasmic.registerToken() inside a custom code component (registered with registerComponent or with registerGlobalContext)? If this sounds too hacky and such practice should be avoided, let me know.

Sorry, I don’t think this is possible currently, but let me try to understand better your use case, you are providing colors in a global context, but at the same time you want those colors provided in the global context to be available as tokens ?

Yes, that is correct.