unitrongroup-ir opened a new issue, #21779:
URL: https://github.com/apache/echarts/issues/21779

   ### Version
   
   6.1.0
   
   ### Steps to Reproduce
   
   Standalone HTML, no external link:
   
   ```html
   <div id="c" style="width:400px;height:300px"></div>
   <script 
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js";></script>
   <script>
     const chart = echarts.init(document.getElementById('c'), 'dark');
     chart.setOption({ xAxis: { type: 'category', data: ['a', 'b'] }, yAxis: 
{}, series: [{ type: 'bar', data: [1, 2] }] });
     chart.setTheme(undefined); // same with null, or a name that was never 
registered ('light')
     // the chart is still dark
     chart.setTheme({});        // this one goes back to the default theme
   </script>
   ```
   
   ### Current Behavior
   
   `ECharts.prototype._updateTheme` only assigns `this._theme` when the 
argument resolves to a truthy theme, so `setTheme(undefined)`, `setTheme(null)` 
and `setTheme('<unregistered name>')` leave the previous theme in place, 
without a warning. There is no documented way to go back to the default theme; 
`setTheme({})` or `registerTheme('light', {})` works, but only by accident. 
`init(dom, undefined)` means "default theme", so `setTheme(undefined)` is 
expected to mean the same.
   
   ### Expected Behavior
   
   `setTheme(undefined | null)` goes back to the default theme, and an 
unregistered name logs a warning in development (like other invalid arguments) 
instead of silently doing nothing.
   
   ### Additional Comments
   
   A plain `chart.getDataURL()` pixel check shows that the dark background 
stays opaque after the three calls and turns transparent after `setTheme({})`. 
Related, but a different problem of the same method: #21200.
   


-- 
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