unocss.config.ts

6528743c40cb1c17b8c593ec5f160961012e227a
wotaku/unocss.config.ts

112 lines · 2947 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 { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
  9import { colors } from '@taskylizard/colors'
 10import { resolve } from 'node:path'
 11import {
 12  defineConfig,
 13  presetAttributify,
 14  presetIcons,
 15  presetUno,
 16  presetWebFonts,
 17  presetWind4,
 18  transformerDirectives
 19} from 'unocss'
 20
 21// Custom icons collection
 22const customIcons = {
 23  circle:
 24    '<svg viewBox="0 0 120 120"><circle cx="60" cy="60" r="50"></circle></svg>'
 25  // Add more custom icons here as needed
 26}
 27
 28const safelist = [
 29  ...Object.entries(colors).flatMap(([group, shades]) =>
 30    Object.keys(shades).flatMap((shade) => [
 31      `text-${group}-${shade}`,
 32      `bg-${group}-${shade}`
 33    ])
 34  ),
 35  'i-lucide:circle-plus',
 36  'i-lucide:circle-alert',
 37  'i-lucide:circle-x',
 38  'i-lucide:lightbulb',
 39  'i-lucide:heart',
 40  'i-lucide:message-circle',
 41  'i-lucide:copy',
 42  'i-lucide:check'
 43]
 44
 45export default defineConfig({
 46  content: {
 47    filesystem: ['.vitepress/configs/constants.ts']
 48  },
 49  safelist,
 50  theme: {
 51    easing: {
 52      'out-expo': 'cubic-bezier(0.16, 1, 0.3, 1)',
 53      'in-expo': 'cubic-bezier(0.7, 0, 0.84, 0)'
 54    },
 55    colors: {
 56      ...colors,
 57      primary: 'var(--vp-c-brand-1)',
 58      bg: 'var(--vp-c-bg)',
 59      'bg-alt': 'var(--vp-c-bg-alt)',
 60      'bg-elv': 'var(--vp-c-bg-elv)',
 61      text: 'var(--vp-c-text-1)',
 62      'text-2': 'var(--vp-c-text-2)',
 63      div: 'var(--vp-c-divider)',
 64      // Ayanami Blue
 65      'brand': {
 66        '50': 'oklch(0.965 0.011 256.71)',
 67        '100': 'oklch(0.93 0.024 256.1)',
 68        '200': 'oklch(0.861 0.048 253.25)',
 69        '300': 'oklch(0.791 0.076 251.19)',
 70        '400': 'oklch(0.722 0.105 247.48)',
 71        '500': 'oklch(0.626 0.098 247.46)',
 72        '600': 'oklch(0.523 0.081 246.86)',
 73        '700': 'oklch(0.43 0.066 246.75)',
 74        '800': 'oklch(0.335 0.052 246.76)',
 75        '900': 'oklch(0.233 0.035 246.39)',
 76        '950': 'oklch(0.186 0.029 247.31)'
 77      }
 78    }
 79  },
 80  presets: [
 81    presetWind4({
 82      preflights: {
 83        theme: true
 84      }
 85    }),
 86    presetAttributify(),
 87    presetWebFonts({
 88      fonts: {
 89        serif: 'Source Serif 4 Variable',
 90        pacifico: {
 91          name: 'Pacifico',
 92          weights: [400],
 93          italic: true
 94        }
 95      }
 96    }),
 97    presetIcons({
 98      scale: 1.2,
 99      extraProperties: {
100        display: 'inline-block',
101        'vertical-align': '-0.125em', // changed from 'middle'
102        'min-width': '1.2rem'
103      },
104      warn: false,
105      collections: {
106        custom: FileSystemIconLoader(resolve(__dirname, 'docs/public/custom')),
107        inline: customIcons
108      }
109    })
110  ],
111  transformers: [transformerDirectives()]
112})