mistercrunch commented on issue #20159:
URL: https://github.com/apache/superset/issues/20159#issuecomment-2574176054

   > One important thing to remember is we will also need to provide a theme 
object for ECharts
   
   Totally. From what I see it seems very doable to extend the antd theme 
system with custom tokens and custom components. From what I see you can 
totally write a ThemeConfig like this:
   
   ```js
   const themeConfig = {
    token: {
       primaryColor: 'red',
       textColorBase: '#AAA',
       customGlobalToken: 'blue', // this item isn't in the official list
       hackyNestedObject: {'hello': 'world'}, // this also works, but diverges 
from their flat approach to tokens.
     }
     components: {
       ECharts: { // this component isn't a registered antd component
         echartSpecificTextSize: '20px',
         textColorBase: '#EEE', //override of textColorBase specific to echarts
       }
     }
   }
   ```
   
   all of which become available through antd's `theme.useToken`, usage similar 
to emotion's `useTheme()` (it's build using it...)
   
   ```js
   // retrieving custom token in component module
   const { customGlobalToken } = theme.useToken();
   
   // retrieving Echarts specific stuff
   const { textColorBase, echartSpecificTextSize } = 
theme.useToken().componentss.Echarts;
   ```
   
   I couldn't find a function that merges flat tokens in the context of a 
specific component, but it's super easy to just merge / override ourselves.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to