add theme-mode
attribution for html
to control the display of light/dark
mode:
// dark mode
document.documentElement.setAttribute("theme-mode", "dark");
// light mode
document.documentElement.removeAttribute("theme-mode");
TDesign uses CSS Variables to implement all color-related Design Tokens. Currently, almost all modern browsers support this feature. We have implemented two sets of color palettes, light and dark, by default, for applying when switching the page theme.
Read the documentation if you have doubts about the browser compatibility of this solution.