in src/themes/themeTools.ts [426:650]
tooltipContainerBorderRadius: pxToNumber(theme['widgets-tooltip-corner-radius']),
/** tooltip 文本颜色 */
tooltipTextFillColor: theme['widgets-tooltip-text'],
/** tooltip 文本字体大小 */
tooltipTextFontSize: fontSize1,
/** tooltip 文本行高 */
tooltipTextLineHeight: fontSize1,
/** tooltip 文本字体粗细 */
tooltipTextFontWeight: 'normal',
// -------------------- Geometry labels --------------------
/** Geometry label 文本颜色 */
labelFillColor: theme['widgets-label-text'],
labelFillColorDark: theme['widgets-label-text'],
labelFillColorLight: '#ffffff',
/** Geometry label 文本字体大小 */
labelFontSize: fontSize1,
/** Geometry label 文本行高 */
labelLineHeight: fontSize1,
/** Geometry label 文本字体粗细 */
labelFontWeight: 'normal',
/** Geometry label 文本描边颜色 */
labelBorderColor: null,
/** Geometry label 文本描边粗细 */
labelBorder: 0,
/** Geometry innerLabel 文本颜色 */
innerLabelFillColor: WHITE_COLORS[100], // CHECK
/** Geometry innerLabel 文本字体大小 */
innerLabelFontSize: fontSize1,
/** Geometry innerLabel 文本行高 */
innerLabelLineHeight: fontSize1,
/** Geometry innerLabel 文本字体粗细 */
innerLabelFontWeight: 'normal',
/** Geometry innerLabel 文本描边颜色 */
innerLabelBorderColor: null,
/** Geometry innerLabel 文本描边粗细 */
innerLabelBorder: 0,
/** Geometry overflowLabel 文本颜色 */
overflowLabelFillColor: theme['widgets-label-text'], // BLACK_COLORS[65],
/** Geometry overflowLabel 文本字体大小 */
overflowLabelFontSize: fontSize1,
/** Geometry overflowLabel 文本行高 */
overflowLabelLineHeight: fontSize1,
/** Geometry overflowLabel 文本字体粗细 */
overflowLabelFontWeight: 'normal',
/** Geometry overflowLabel 文本描边颜色 */
overflowLabelBorderColor: WHITE_COLORS[100],
/** Geometry overflowLabel 文本描边粗细 */
overflowLabelBorder: 1,
/** Geometry label 文本连接线粗细 */
labelLineBorder: 1,
/** Geometry label 文本连接线颜色 */
labelLineBorderColor: theme['widgets-label-text'], // CHECK
// -------------------- Geometry 图形样式--------------------
/** 点图填充颜色 */
pointFillColor: QUALITATIVE_10[0],
/** 点图填充颜色透明度 */
pointFillOpacity: 0.95,
/** 点图大小 */
pointSize: 3,
/** 点图描边粗细 */
pointBorder: 0,
/** 点图描边颜色 */
pointBorderColor: WHITE_COLORS[100],
/** 点图描边透明度 */
pointBorderOpacity: 1,
/** 点图 active 状态下描边颜色 */
pointActiveBorderColor: BLACK_COLORS[100],
pointActiveBorder: 0,
/** 点图 selected 状态下描边粗细 */
pointSelectedBorder: 1.5,
/** 点图 selected 状态下描边颜色 */
pointSelectedBorderColor: BLACK_COLORS[100],
/** 点图 inactive 状态下填充颜色透明度 */
pointInactiveFillOpacity: 0.3,
/** 点图 inactive 状态下描边透明度 */
pointInactiveBorderOpacity: 0.3,
/** 空心点图大小 */
hollowPointSize: 3,
/** 空心点图描边粗细 */
hollowPointBorder: 1.5,
/** 空心点图描边颜色 */
hollowPointBorderColor: QUALITATIVE_10[0],
/** 空心点图描边透明度 */
hollowPointBorderOpacity: 1,
hollowPointFillColor: WHITE_COLORS[100],
/** 空心点图 active 状态下描边粗细 */
hollowPointActiveBorder: 1.5,
/** 空心点图 active 状态下描边颜色 */
hollowPointActiveBorderColor: QUALITATIVE_10[0],
/** 空心点图 active 状态下描边透明度 */
hollowPointActiveBorderOpacity: 1,
/** 空心点图 selected 状态下描边粗细 */
hollowPointSelectedBorder: 1.5,
/** 空心点图 selected 状态下描边颜色 */
hollowPointSelectedBorderColor: QUALITATIVE_10[0],
/** 空心点图 selected 状态下描边透明度 */
hollowPointSelectedBorderOpacity: 1,
/** 空心点图 inactive 状态下描边透明度 */
hollowPointInactiveBorderOpacity: 0.3,
/** 线图粗细 */
lineBorder: theme['widgets-line-width'],
/** 线图颜色 */
lineBorderColor: QUALITATIVE_10[0],
/** 线图透明度 */
lineBorderOpacity: 1,
/** 线图 Active 状态下粗细 */
lineActiveBorder: theme['widgets-line-width'],
/** 线图 selected 状态下粗细 */
lineSelectedBorder: 3,
/** 线图 inactive 状态下透明度 */
lineInactiveBorderOpacity: 0.3,
/** area 填充颜色 */
areaFillColor: QUALITATIVE_10[0],
/** area 填充透明度 */
areaFillOpacity: theme['widgets-shape-area-opacity'],
/** area 在 active 状态下的填充透明度 */
areaActiveFillColor: QUALITATIVE_10[0],
areaActiveFillOpacity: theme['widgets-shape-area-opacity'],
/** area 在 selected 状态下的填充透明度 */
areaSelectedFillColor: QUALITATIVE_10[0],
areaSelectedFillOpacity: 0.5,
/** area inactive 状态下填充透明度 */
areaInactiveFillOpacity: 0.3 * theme['widgets-shape-area-opacity'],
/** hollowArea 颜色 */
hollowAreaBorderColor: QUALITATIVE_10[0],
/** hollowArea 边框粗细 */
hollowAreaBorder: 2,
/** hollowArea 边框透明度 */
hollowAreaBorderOpacity: 1,
/** hollowArea active 状态下的边框粗细 */
hollowAreaActiveBorder: 3,
hollowAreaActiveBorderColor: BLACK_COLORS[100],
/** hollowArea selected 状态下的边框粗细 */
hollowAreaSelectedBorder: 3,
hollowAreaSelectedBorderColor: BLACK_COLORS[100],
/** hollowArea inactive 状态下的边框透明度 */
hollowAreaInactiveBorderOpacity: 0.3,
/** interval 填充颜色 */
intervalFillColor: QUALITATIVE_10[0],
/** interval 填充透明度 */
intervalFillOpacity: theme['widgets-shape-interval-opacity'],
/** interval active 状态下边框粗细 */
intervalActiveBorder: 0,
/** interval active 状态下边框颜色 */
intervalActiveBorderColor: 'rgba(0,0,0,0)',
intervalActiveBorderOpacity: 1,
/** interval selected 状态下边框粗细 */
intervalSelectedBorder: 2,
/** interval selected 状态下边框颜色 */
intervalSelectedBorderColor: 'rgba(0,0,0,0)',
/** interval selected 状态下边框透明度 */
intervalSelectedBorderOpacity: 1,
/** interval inactive 状态下边框透明度 */
intervalInactiveBorderOpacity: 0.3,
/** interval inactive 状态下填充透明度 */
intervalInactiveFillOpacity: 0.3,
/** interval 边框粗细 */
hollowIntervalBorder: 2,
/** hollowInterval 边框颜色 */
hollowIntervalBorderColor: QUALITATIVE_10[0],
/** hollowInterval 边框透明度 */
hollowIntervalBorderOpacity: 1,
hollowIntervalFillColor: theme['widgets-color-background'], // WHITE_COLORS[100],
/** hollowInterval active 状态下边框粗细 */
hollowIntervalActiveBorder: 2,
/** hollowInterval active 状态下边框颜色 */
hollowIntervalActiveBorderColor: BLACK_COLORS[100],
/** hollowInterval selected 状态下边框粗细 */
hollowIntervalSelectedBorder: 3,
/** hollowInterval selected 状态下边框颜色 */
hollowIntervalSelectedBorderColor: BLACK_COLORS[100],
/** hollowInterval selected 状态下边框透明度 */
hollowIntervalSelectedBorderOpacity: 1,
/** hollowInterval inactive 状态下边框透明度 */
hollowIntervalInactiveBorderOpacity: 0.3,
};
}
const legendKeys = ['common', 'top', 'right', 'bottom', 'left'];
export function getG2theme(theme: Theme) {
const g2StyleSheet = getG2StyleSheet(theme);
const g2Theme = createThemeByStyleSheet(g2StyleSheet);
// g2Theme.maxColumnWidth = 36;
const baseFontSize = theme['widgets-font-size-1'];
const baseFontSizeNum = pxToNumber(theme['widgets-font-size-1']);
// legend 样式
const legendStyle = g2Theme.components.legend;
legendKeys.forEach((key) => {