12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import _ from 'lodash'
- export function settingToTheme (config, type) {
-
-
- if (['dark', 'light'].includes(type)) {
- const theme = { dark: { ...config?.theme?.dark }, light: { ...config?.theme?.light } }
- config.setting.forEach((setItem) => {
- if (['gradual', 'colorPicker', 'colorSelect'].includes(setItem.type)) {
- theme[type][setItem.field] = setItem.value
- }
- })
- return theme
- } else {
- return {}
- }
- }
- export function themeToSetting (chartList, type, _this) {
-
- if (['dark', 'light'].includes(type)) {
- chartList.forEach(chart => {
- chart.option.theme = type
- if (chart.theme && chart.theme[type]) {
- for (const item of chart.setting) {
-
- if (Object.prototype.hasOwnProperty.call(chart.theme[type], item.field)) {
-
- item.value = chart.theme[type][item.field]
- }
- }
- }
- })
- }
- return chartList
- }
|