unocss.config.ts

2e40672e14ba9b3e1cb3e93a3fde2a234bbb07f1
wotaku/unocss.config.ts history · blame · raw

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