Liquid Snippets by ALSEL
📘 公式リファレンス📦 リファレンス/オブジェクト初級

brand_color オブジェクト

Shopify 管理画面の「ブランドアセット」で定義されたストアのブランドカラーにアクセスするオブジェクト。プライマリ・セカンダリ色グループごとに、背景色と前景色(対比用)を取得できる。

用途
ストアのブランドカラーをテーマに自動適用したいとき。管理画面でカラーを更新するだけでテーマ全体の色が変わるようにしたい場合に使用。
設置場所
テンプレートやセクション内で `{{ shop.brand.colors.primary[0].background }}` のように参照する。`primary` または `secondary` のグループ、`background` または `foreground` のロール、配列インデックス(0 から始まる)を指定して色コードを取得。
注意点
ブランドアセットが Shopify 管理画面で事前設定されていることが前提。存在しないグループやロール、インデックスを指定すると `nil` が返される。プライマリ・セカンダリ各グループに複数の色ペアを登録した場合、CSS 変数として定義して Liquid ループで参照するとテーマの保守性が上がる。
タグ:brandcolorshopassettheme-settings

仕様

43 行 / json
{
  "access": {
    "global": false,
    "parents": [
      {
        "object": "brand",
        "property": "colors"
      }
    ],
    "template": []
  },
  "deprecated": false,
  "deprecation_reason": "",
  "description": "",
  "properties": [],
  "summary": "The colors defined as part of a store's [brand assets](https://help.shopify.com/manual/promoting-marketing/managing-brand-assets).",
  "name": "brand_color",
  "examples": [
    {
      "name": "",
      "description": "To access a brand color, specify the following:\n- The brand color group: either `primary` or `secondary`\n- The color role: Whether the color is a `background` or `foreground` (contrasting) color\n- The 0-based index of the color within the group and role\n",
      "syntax": "shop.brand.colors.group[index].role",
      "path": "/",
      "raw_liquid": "{{ shop.brand.colors.primary[0].background }}\n{{ shop.brand.colors.primary[0].foreground }}\n{{ shop.brand.colors.secondary[0].background }}\n{{ shop.brand.colors.secondary[1].background }}\n{{ shop.brand.colors.secondary[0].foreground }}",
      "parameter": false,
      "display_type": "text",
      "show_data_tab": true
    }
  ],
  "json_data": {
    "path": "",
    "handle": "",
    "data_from_file": ""
  },
  "return_type": [
    {
      "type": "string",
      "name": "",
      "description": "",
      "array_value": ""
    }
  ]
}

出典・ライセンス

License:
MIT

このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。

関連項目

📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_header オブジェクト

Shopify が必要とするスクリプト(分析・チェックアウト・言語設定など)をすべて動的に出力するオブジェクト。theme.liquid の <head> タグ内に埋め込む必須要素。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト中級

metaobjects オブジェクト

ストア全体のメタオブジェクト定義にアクセスするグローバルオブジェクト。個別のメタオブジェクトはタイプとハンドルで参照でき、メタオブジェクト定義のエントリをループで反復処理できる。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト初級

additional_checkout_buttons オブジェクト

PayPal Express Checkout など、オフサイト決済に対応した外部決済プロバイダーがストアに設定されているかを真偽値で返す。`content_for_additional_checkout_buttons` と組み合わせて、該当するチェックアウトボタンを条件付きで表示する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

canonical_url オブジェクト

現在のページの正規 URL を取得するオブジェクト。Google などの検索エンジンに対してどのページ版が正規であるかを指定するために使用する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_index オブジェクト

ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_additional_checkout_buttons オブジェクト

PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。

📁 theme-liquid-docs·MIT·27