unpreset / unocss-preset-theme

The dynamic theme presets for UnoCSS.
https://unocss-preset-theme.todev.cc
119 stars 11 forks source link

【Feature】Skip the load on demand detection and generate all variables #67

Open itmanyong opened 8 months ago

itmanyong commented 8 months ago

Examples include the following presets and uses

{
  theme:{
    colors:{
      red: 'red',
      green: 'green'
    }
  },
  presets: [
    presetUno(),
    presetTheme({
      prefix: '--theme',
      theme: {
        light: {
          red: 'red',
          green: 'green'
        }
      }
    })
  ]
}
<button class="text-red">按钮</button>

presetTheme generates the associated style variable

:root:{
  --theme-colors-red:255, 0, 0
}

The current desired build result

:root:{
  --theme-colors-red:255, 0, 0,
  --theme-colors-green:0, 255, 0
}

Regardless of whether the corresponding css variable is used in the source code, it is directly generated. Add a configuration switch?

Dunqing commented 8 months ago

Sounds good. I'll think about making it happen.