unocss.config.ts

fb8b13995535e1ea618da7f5d3b445e235711da1
wotaku/unocss.config.ts history · blame · raw

67 lines · 1736 bytes

 1/**
 2*  All Rights Reserved
 3*
 4*  Copyright (c) 2025 taskylizard
 5*
 6*  All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder.
 7*/
 8import { colors } from '@taskylizard/colors'
 9import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
10import { resolve } from 'node:path'
11import {
12  defineConfig,
13  presetUno,
14  presetAttributify,
15  presetIcons,
16  transformerDirectives
17} from 'unocss'
18
19// Custom icons collection
20const customIcons = {
21  circle:
22    '<svg viewBox="0 0 120 120"><circle cx="60" cy="60" r="50"></circle></svg>'
23  // Add more custom icons here as needed
24}
25
26const safelist = Object.entries(colors).flatMap(([group, shades]) =>
27  Object.keys(shades).flatMap((shade) => [
28    `text-${group}-${shade}`,
29    `bg-${group}-${shade}`
30  ])
31)
32
33export default defineConfig({
34  content: {
35    filesystem: ['.vitepress/configs/constants.ts']
36  },
37  safelist,
38  theme: {
39    colors: {
40      ...colors,
41      primary: 'var(--vp-c-brand-1)',
42      bg: 'var(--vp-c-bg)',
43      'bg-alt': 'var(--vp-c-bg-alt)',
44      'bg-elv': 'var(--vp-c-bg-elv)',
45      text: 'var(--vp-c-text-1)',
46      'text-2': 'var(--vp-c-text-2)',
47      div: 'var(--vp-c-divider)'
48    }
49  },
50  presets: [
51    presetUno(),
52    presetAttributify(),
53    presetIcons({
54      scale: 1.2,
55      extraProperties: {
56        display: 'inline-block',
57        'vertical-align': 'middle'
58      },
59      warn: true,
60      collections: {
61        custom: FileSystemIconLoader(resolve(__dirname, 'docs/public/custom')),
62        inline: customIcons
63      }
64    })
65  ],
66  transformers: [transformerDirectives()]
67})