<li id="5hhk0"></li>

  • <\/code> or root element, the style of the entire page will automatically change.<\/p>

    Using variables in components<\/h3>

    Once the variables are defined, you can use them in any CSS rule: <\/p>\"How

     .button {\n  background-color: var(--color-primary);\n  color: var(--color-text);\n}<\/pre>

    The advantage of this is that no matter what theme is currently, the buttons will automatically adapt to the corresponding color<\/strong> , and there is no need to write a style for each theme separately.<\/p>

    You can also nest variables, such as setting a default value:<\/p>

     background-color: var(--custom-bg, var(--color-bg));<\/pre>

    This means that if --custom-bg<\/code> is not defined, --color-bg<\/code> will be replaced.<\/p>


    How to dynamically switch topics<\/h3>

    To make the topic switchable, it is generally necessary to manipulate class names or data attributes. For example:<\/p>

     
    1. <thead id="seseb"></thead>
        • <blockquote id="seseb"></blockquote>