mancuoj

mancuoj

Better late than never.
github
twitter

Tailwind Typography Plugin Dark Mode Adaptation Method

The simplest way is to use the prose-invert provided by the official:

<div className="prose dark:prose-invert">
  ...
</div>

Another way: Customize colors, for example, I use shadcn/ui and want to keep the colors consistent, you can set it in the tailwind configuration file:

// tailwind.config.js/ts
const config = {
  theme: {
    colors: {
      border: 'hsl(var(--border))',
      input: 'hsl(var(--input))',
      ring: 'hsl(var(--ring))',
      background: 'hsl(var(--background))',
      foreground: 'hsl(var(--foreground))',
      // Other color settings
    },
    extend: {
      // ...
      typography: {
        DEFAULT: {
          css: {
            color: 'hsl(var(--foreground))',
            h1: {
              color: 'hsl(var(--primary))',
            },
            // Other tag settings
          },
        },
      },
    },
  },
} satisfies Config
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.