Menu

テーマの置き換えとカスタマイズガイド

注意

  • このドキュメントを使用する前に、package.jsonversionフィールドでバージョン番号を確認し、このドキュメントの該当セクションをお読みください
  • バージョン3.2.0以降、Nexty.devはTailwind v4を使用しています
  • バージョン3.2.0より前は、Nexty.devはTailwind v3を使用しています

Nexty.devはTailwind CSS v4CSS変数をベースとした最新のスタイリングシステムを採用し、完全なライト/ダークテーマの切り替えに対応しています。このガイドでは、プロジェクトのテーマを置き換えてカスタマイズする方法について説明します。

v3.2.0以降のバージョン(Tailwind v4)

テーマ関連のファイルは主に以下の場所にあります:

styles/
├── globals.css          # メインスタイルファイル、テーマ変数とTailwind設定を含む
└── custom.utilities.css # カスタムユーティリティクラス
  1. tweakcn.comのオンラインエディタで希望のテーマを選択し、右上のCodeをクリックしてスタイルをコピーします
code
code-copy
  1. styles/globals.cssファイル内の:root.dark@theme inlineセクションを置き換えます

v3.2.0より前のバージョン(Tailwind v3)

テーマ関連のファイルは主に以下の場所にあります:

styles/
├── globals.css      # メインスタイルファイル、テーマ変数とTailwind設定を含む
└── theme.css        # カスタムユーティリティクラス
  1. theme.cssは元々グラデーションカラー設定用に設計されており、テーマ変更の難易度を上げているため、テーマを変更する前にtheme.cssのコードを以下のスタイルに置き換えてください:

注意

nexty-directoryボイラープレートはこのステップを実行する必要はありません

styles/theme.css
@tailwind base;
@tailwind components;
@tailwind utilities;
 
@layer components {
  :root {
    --color-1: 0 100% 63%;
    --color-2: 270 100% 63%;
    --color-3: 210 100% 63%;
    --color-4: 195 100% 63%;
    --color-5: 90 100% 63%;
  }
}
@layer components {
  .title-gradient {
    @apply text-foreground/90;
  }
 
  .dark .title-gradient {
    @apply bg-clip-text bg-gradient-to-b from-foreground to-muted-foreground text-transparent;
  }
 
  .highlight-text {
    @apply text-primary dark:text-primary;
  }
 
  .highlight-bg {
    @apply bg-primary dark:bg-primary text-white;
  }
 
  .highlight-button {
    @apply text-white dark:text-white px-8 py-3 rounded-lg font-medium text-center shadow-lg transition-all duration-200;
    @apply bg-primary dark:bg-primary;
  }
 
  .card {
    @apply transition-all duration-300 border border-gray-200 dark:border-gray-700;
  }
 
  .card:hover {
    transform: translateY(-4px);
    @apply border-primary dark:border-primary;
  }
 
  .theme {
    --animate-rainbow: rainbow var(--speed, 2s) infinite linear;
  }
}
 
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0px); }
}
 
@theme inline {
  @keyframes rainbow {
  0% {
    background-position: 0%;
    }
  100% {
    background-position: 200%;
    }
  }
}
  1. tweakcn.comのオンラインエディタで希望のテーマを選択し、右上のCodeをクリックしてスタイルをコピーします
code
code-copy
  1. styles/globals.cssファイル内の:root.darkセクションを置き換えます