カスタムテーマ

phpMyAdmin には、サードパーティのテーマに対応しています。追加のテーマは、私たちのウェブサイト <https://www.phpmyadmin.net/themes/> からダウンロードできます。

設定

Themes are configured with $cfg['ThemeManager'] and $cfg['ThemeDefault']. Under ./public/themes/, you should not delete the directory pmahomme or its underlying structure, because this is the system theme used by phpMyAdmin. pmahomme contains all images and styles, for backwards compatibility and for all themes that would not include images or css-files. If $cfg['ThemeManager'] is enabled, you can select your favorite theme on the main page. Your selected theme will be stored in a cookie.

カスタムテーマの作成

テーマを作成するには、以下のようにします。

  • make a new subdirectory (for example "your_theme_name") under ./public/themes/.
  • pmahomme から "your_theme_name" にファイルやディレクトリをコピーします
  • "your_theme_name/css" の CSS ファイルを編集します
  • "your_theme_name/img" に新しい画像を入れます
  • "your_theme_name/scss" の _variables.scss を編集します
  • "your_theme_name" の theme.json を編集してテーマのメタデータを設定します (下記参照)
  • テーマの新しいスクリーンショットを作成して、 "your_theme_name/screen.png" に保存します

テーマのメタデータ

バージョン 4.8.0 で変更: 4.8.0 以前は、テーマのメタデータは info.inc.php ファイルで渡されていました。これをは theme.json に置き換えられ、より簡単に解析ができるようになり (PHP コードを扱う必要がなくなり)、追加機能に対応するようになりました。

テーマディレクトリには、テーマのメタデータを含むファイル theme.json があります。現在のところ、以下の要素があります。

name

テーマの表示名です。

このフィールドは必須です。

version

テーマのバージョンです。自由に設定することができ、 phpMyAdmin のバージョンと一致させる必要はありません。

このフィールドは必須です。

description

テーマの説明です。これはウェブサイトに表示されます。

このフィールドは必須です。

author

テーマの作者の名前です。

このフィールドは必須です。

url

作者のウェブサイトへのリンクです。そこでサポートを受けられるようにするといいでしょう。

supports

対応している phpMyAdmin のメジャーバージョンの配列です。

このフィールドは必須です。

たとえば、phpMyAdmin 4.8 に付属しているオリジナルテーマの定義は次の通りです。

{
    "name": "Original",
    "version": "4.8",
    "description": "Original phpMyAdmin theme",
    "author": "phpMyAdmin developers",
    "url": "https://www.phpmyadmin.net/",
    "supports": ["4.8"]
}

画像の共有

独自の記号やボタンを使用しない場合は、 "your_theme_name" から "img" ディレクトリを削除してください。デフォルトの (システムテーマである pmahomme の) アイコンやボタンが使われます。