unocss.config.ts

87e89bbd05e11ad365524dbc66500fd5a43b7bd2
wotaku/unocss.config.ts history · blame · raw

110 lines · 2906 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]
 42
 43export default defineConfig({
 44  content: {
 45    filesystem: ['.vitepress/configs/constants.ts']
 46  },
 47  safelist,
 48  theme: {
 49    easing: {
 50      'out-expo': 'cubic-bezier(0.16, 1, 0.3, 1)',
 51      'in-expo': 'cubic-bezier(0.7, 0, 0.84, 0)'
 52    },
 53    colors: {
 54      ...colors,
 55      primary: 'var(--vp-c-brand-1)',
 56      bg: 'var(--vp-c-bg)',
 57      'bg-alt': 'var(--vp-c-bg-alt)',
 58      'bg-elv': 'var(--vp-c-bg-elv)',
 59      text: 'var(--vp-c-text-1)',
 60      'text-2': 'var(--vp-c-text-2)',
 61      div: 'var(--vp-c-divider)',
 62      // Ayanami Blue
 63      'brand': {
 64        '50': 'oklch(0.965 0.011 256.71)',
 65        '100': 'oklch(0.93 0.024 256.1)',
 66        '200': 'oklch(0.861 0.048 253.25)',
 67        '300': 'oklch(0.791 0.076 251.19)',
 68        '400': 'oklch(0.722 0.105 247.48)',
 69        '500': 'oklch(0.626 0.098 247.46)',
 70        '600': 'oklch(0.523 0.081 246.86)',
 71        '700': 'oklch(0.43 0.066 246.75)',
 72        '800': 'oklch(0.335 0.052 246.76)',
 73        '900': 'oklch(0.233 0.035 246.39)',
 74        '950': 'oklch(0.186 0.029 247.31)'
 75      }
 76    }
 77  },
 78  presets: [
 79    presetWind4({
 80      preflights: {
 81        theme: true
 82      }
 83    }),
 84    presetAttributify(),
 85    presetWebFonts({
 86      fonts: {
 87        serif: 'Source Serif 4 Variable',
 88        pacifico: {
 89          name: 'Pacifico',
 90          weights: [400],
 91          italic: true
 92        }
 93      }
 94    }),
 95    presetIcons({
 96      scale: 1.2,
 97      extraProperties: {
 98        display: 'inline-block',
 99        'vertical-align': '-0.125em', // changed from 'middle'
100        'min-width': '1.2rem'
101      },
102      warn: true,
103      collections: {
104        custom: FileSystemIconLoader(resolve(__dirname, 'docs/public/custom')),
105        inline: customIcons
106      }
107    })
108  ],
109  transformers: [transformerDirectives()]
110})