logo

S2

  • Manual
  • API
  • Examples
  • Playground
  • ChangeLog
  • Productsantv logo arrow
  • 2.x
  • Common Configuration
    • S2DataConfig
    • S2Options
      Updated
    • S2Theme
      Updated
    • S2Event
  • Basic Class
    • SpreadSheet
    • Interaction
      Updated
    • Store
    • BaseCell
      Updated
    • BaseDataSet
    • Node
    • BaseTooltip
    • BaseFacet
      Updated
    • Hierarchy
      New
    • BaseBBox
      New
    • CellData
      New
  • Components
    • table component
    • DrillDown
    • Switcher
    • Advanced Sort
    • Export
      Updated
  • Graphic style
  • 透视组合图拓展 S2Options

S2Theme

Previous
S2Options
Next
S2Event

Resources

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-互动图形解决方案
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

theme configuration

// 统一设置主题 Schema, 色板,名称
s2.setThemeCfg({
theme: {},
palette: {},
name: "default"
});
// 单独设置主题 Schema, 配置单元格背景,文字大小,文字颜色
s2.setTheme({
rowCell: {
cell: {
backgroundColor: "#fff"
}
}
});

ThemeCfg

optional object

Function description: Table theme configuration items

parameterparametertypeDefaultsrequired
themetheme schemaS2Theme-
paletteswatchesPalette-
namesubject namedefault | colorful | graydefault

Palette

optional object

Function description: Table theme swatches

parameterparametertypeDefaultsrequired
brandColorSwatch theme colorstring-✓
basicColorsbase colorstring[]-✓
basicColorRelationsThe correspondence between basicColors and the subscripts of the standard color palette arrayArray<{ basicColorIndex: number; standardColorIndex: number;}>-✓
semanticColorsColors used to represent the actual business semantics. For example, the built-in color "red fall green rise"[key: string]-✓
othersColors used to represent the actual business semantics. For example, the built-in color "red fall green rise"[key: string]-

S2Theme

optional object

Function description: Table theme Schema

parameterparametertypeDefaultsrequired
cornerCellCorner header cell themeDefaultCellTheme
rowCellRow header cell themeDefaultCellTheme
colCellColumn header cell themeDefaultCellTheme
dataCellNumeric Cell ThemeDefaultCellTheme
resizeAreaColumn Width Row Height Adjustment HotspotResizeArea
scrollBarscroll bar styleScrollBarTheme
splitLineCell divider styleSplitLine
prepareSelectMaskBrush mask styleInteractionStateTheme
backgroundbackground stylebackground
[key: string]Additional attribute fields, used for passing parameters when users customize themesunknown

DefaultCellTheme

optional object

Function description: Default cell theme

parameterillustratetypeDefaultsrequired
bolderTextbold text styleTextTheme-
texttext styleTextTheme-
seriesTextOrdinal text styleTextTheme-
measureTextMetric Text StyleTextTheme-
cellcell styleCell Theme-
iconicon styleIconTheme-
seriesNumberWidthSerial Number Column Widthnumber80
miniChartmini-figureMiniChartTheme

ResizeArea

optional object

Function description: Column width row height drag hot zone style

parameterillustratetypeDefaultsrequired
sizeHot zone sizenumber3
backgroundHot zone background colorstring-
backgroundOpacityHotspot background color transparencynumber-
guideLineColorGuide Colorstring-
guideLineDashHot Zone Guide Dashed Line Modenumber[][3, 3]
interactionStateHot zone interactive state styleInteractionState-

ScrollBarTheme

optional object

Function description: scroll bar style

parameterillustratetypeDefaultsrequired
trackColorScrollbar track colorstringrgba(0,0,0,0)
thumbHoverColorScrollbar Hover state colorstringrgba(0,0,0,0.4)
thumbColorscrollbar colorstringrgba(0,0,0,0.15)
thumbHorizontalMinSizeThe horizontal minimum size of the scroll bar (in the case of a large number, the scroll bar will be very small, and the minimum size of the horizontal scroll bar can be configured)string32
thumbVerticalMinSizeThe vertical minimum size of the scroll bar (in the case of a large number, the scroll bar will be very small, and the minimum size of the vertical scroll bar can be configured)string32
sizescroll bar sizenumberMobile: 3
PC: 6
hoverSizeThe size of the scrollbar when Hovernumber16
lineCapSpecifies how to draw the end of each line segmentbutt | round | squareround

SplitLine

optional object

Function description: Split line style

parameterillustratetypeDefaultsrequired
horizontalBorderColorHorizontal divider colorstring-
horizontalBorderColorOpacityHorizontal divider color transparencynumber0.2
horizontalBorderWidthHorizontal split line widthnumber2
verticalBorderColorvertical line colorstring-
verticalBorderColorOpacityVertical split line color transparencynumber0.25
verticalBorderWidthVertical dividing line widthnumber2
showShadowWhether to display the outer shadow of the dividing line (in the case of frozen rows and columns)booleantrue
shadowWidthshadow widthnumber10
shadowColorsleft : change the left color linearly
right : change the color of the right side linearly
{left: string,
right: string}
{left: 'rgba(0,0,0,0.1)',
right: 'rgba(0,0,0,0)'}

TextTheme

optional object

Function Description: Text Theme

parameterillustratetypeDefaultsrequired
textAlignAlignment of text contentleft | center | right-
textBaselineBaseline when drawing texttop | middle | bottom-
fontFamilyfontstringRoboto, PingFangSC, Microsoft YaHei, Arial, sans-serif
fontSizefont sizenumber-
fontWeightnumber
string: normal
bold
bolder
lighter font weight
number | stringBold text: Mobile: 520 PC: bold
Normal text: normal
fillfont colorstring-
linkTextFilllink text colorstring-
opacityfont transparencynumber1

Cell Theme

optional object

Function description: Cell general theme

parameterillustratetypeDefaultsrequired
crossBackgroundColorCardinal row cell background colorstring-
backgroundColorcell background colorstring-
backgroundColorOpacityCell background color transparencynumber1
horizontalBorderColorCell horizontal border colorstring-
horizontalBorderColorOpacityCell horizontal border color transparencynumber1
horizontalBorderWidthCell horizontal border widthnumber-
verticalBorderColorCell vertical border colorstring-
verticalBorderColorOpacityCell vertical border color transparencynumber1
verticalBorderWidthcell vertical border widthnumber-
paddingcell paddingPadding-
interactionStatecell interaction stateInteractionStateTheme-

IconTheme

optional object

Function description: icon general theme

parameterillustratetypeDefaultsrequired
fillicon fill colorstring-
sizeicon sizenumber-
margincell marginMargin-

InteractionStateTheme

optional object

Function description: interactive general theme

parameterillustratetypeDefaultsrequired
backgroundColorbackground fill colorstring
backgroundOpacitybackground transparencynumber
borderColorEdge fill colorstring
borderWidthEdge Widthnumber
borderOpacityborder transparencynumber
textOpacitytext transparencynumber
opacityoverall transparencynumber

Margin|Padding

optional object

Function description: icon outer margin, cell inner margin

parameterillustratetypeDefaultsrequired
topsuperiornumber
rightrightnumber
bottomDownnumber
leftLeftnumber

background

optional object

Function description: background configuration

parameterillustratetypeDefaultsrequired
colorcolorstring-
opacitytransparencynumber1

MiniChartTheme

Function description: sparkline configuration

parameterillustratetypeDefaultsrequired
lineLine chart style configurationLine Theme
barHistogram style configurationBar Theme
bulletcolorBullet Theme
intervaltransparencyInterval Theme

Line Theme

Function description: mini line chart style configuration

parameterillustratetypeDefaultsrequired
pointPoint Configuration for Line Charts{size: number; fill?: number; opacity?: number}
linkLineLine Configuration for Line Charts{size: number; fill: number; opacity: number}

Bar Theme

Function description: mini histogram style configuration

parameterillustratetypeDefaultsrequired
intervalPaddingInterval distance between histogramsnumber
fillcolor fillstring
opacitytransparencynumber

Bullet Theme

Function description: mini bullet chart style configuration

parameterillustratetypeDefaultsrequired
progressBarprogress bar styleProgress Bar
comparative measuremeasurement markersComparative Measure
rangeColorsBullet chart status colorRangeColors
backgroundColorBullet chart background colorstring

Progress Bar

Function description: mini bullet chart progress bar style configuration

parameterillustratetypeDefaultsrequired
widthPercentRatio of bullet chart width relative to cell content, decimalnumber
heighthighnumber
innerHeightinner heightnumber

Comparative Measure

Function description: mini bullet chart measurement marker line style configuration

parameterillustratetypeDefaultsrequired
widthwidthnumber
heighthighnumber
fillcolor fillstring
opacitytransparencynumber

RangeColors

Function description: mini bullet chart state color style configuration

parameterillustratetypeDefaultsrequired
goodsatisfystring
satisfactorygoodstring
baddid not meet expectationsstring

Interval Theme

Function description: mini bar chart style (conditional formatting)

parameterillustratetypeDefaultsrequired
heightbar heightnumber
fillcolor fillstring