CSSツール

CSS light-dark()関数ジェネレーター

変数の重複なしでダークモード用のcolor-schemeとlight-dark()ルールを生成します。

ツールを読み込み中...

CSS light-dark()関数ジェネレーターとは

CSS light-dark()関数ジェネレーターは、変数の重複なしでダークモード用のcolor-schemeとlight-dark()ルールを生成します。 出力は公開サイトに使う前に確認しやすい形で表示されます。

Quick answer

The light-dark() CSS function returns one of two color values based on the current color scheme, making it easy to support light and dark modes without duplicating CSS rules.

Limitations

  • light-dark() only works when the color-scheme property is set on the document or element. Without it the function defaults to the first color.
  • The function accepts exactly two color values -- one for light and one for dark. Complex theme switching still requires custom properties or media queries.
  • Older browsers do not support light-dark(). Provide a fallback color before the light-dark() function in the property declaration.

使い方

  1. 必要な値を入力します。
  2. 結果パネルの出力を確認します。
  3. ページに合う部分だけコピーします。
  4. 公開前にブラウザとホスティング環境で確認します。

主な用途

  • 公開前の繰り返し作業を短くする。
  • マークアップ、CSS、チェックリストを準備する。
  • 静的サイトで見落としやすい小さなミスを減らす。

よくあるミス

  • 出力を確認せず本番に入れる。
  • 公開URLではなくローカルURLを使う。
  • build後に公開フォルダ内のファイルを確認しない。

Verification

  1. Toggle the page between light and dark mode using DevTools Rendering or the OS setting and verify colors switch correctly.
  2. Test in a browser that does not support light-dark() to confirm the fallback color is applied.

FAQ

CSS light-dark()関数ジェネレーターのFAQ

CSS light-dark()関数ジェネレーターはブラウザ内で動きますか?

はい。現在のツールはブラウザで出力を生成する設計です。

出力のテストは必要ですか?

はい。テンプレート、ブラウザ、ホスティング設定に合わせて必ず確認してください。

関連ツール

その他のcssツール

こちらもお試しください

こちらもお試しください