Ovilia opened a new issue, #20202:
URL: https://github.com/apache/echarts/issues/20202
### What problem does this feature solve?
### Current Issues
Currently, ECharts' themes (colors, line widths, etc.) have the following
sources, listed in order from lowest to highest priority:
1. Hardcoded literals within the source code for various components.
2. Theme files introduced via `echarts.registerTheme`.
3. Settings applied through `chart.setOption`.
The issues are:
1. The hardcoded literals in the source code are scattered across various
components, lacking consistent and unified management, leading to arbitrary use
of default color values.
2. When users customize themes, they mostly rely on themes exported from the
theme editor due to the lack of systematic documentation for the
`registerTheme` parameters. The theme editor also sets colors by directly
selecting literal values, lacking consistency and unity.
3. Setting themes through configuration options usually requires
modifications in various different settings, making it cumbersome.
4. The night mode is essentially a hardcoded theme file. If developers
customize the day mode, they usually need additional development work to adapt
it for night mode, making it impossible to switch modes with a single click.
### Technical Solutions
#### Source Code:
1. **Design Token Mechanism**:
- Introduce a new set of Design Tokens. When using properties like color
and line width, components and chart series will use token names instead of
literal values.
2. **New API**:
- Introduce a new `echarts.registerTokens` API to replace the previous
`echarts.registerTheme` API. This new API will be used to replace default token
values and can also specify custom tokens.
3. **Configuration Upgrade**:
- Upgrade to support setting using token names instead of literals in
`chart.setOption`.
4. **Night Mode**:
- Introduce a new API for one-click switching to night mode. This API
will automatically convert day colors to night colors based on a color
conversion algorithm (considering different algorithms for text, background,
border colors, etc.).
### What does the proposed API look like?
#### Theme Editor:
1. **New Theme Editor**:
- Redevelop a theme editor, which includes management of tokens (users
can change token values using a color picker) and specifies which tokens are
used for various properties in chart components and series.
--
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]