颜色选择器到文本模式

时间:2019-02-27 09:08:57

标签: json schema shopify liquid

我试图添加颜色选择器以更改标题的颜色,但是我无法锻炼如何在标题和颜色选择器之间添加关系。

此文件当前未保存为无效的Json,但这是我添加到“ hero.liquid文件”部分中的内容

  {
    "type": "text",
    "id": "title",
    "label": "Heading",
    "default": "Image with text overlay"
    "settings": [
     {
      "type": "color",
      "id": "color_title",
      "label": "Heading color",
      "default": "#FFFFFF"
     }      
    ]
  },

如果我将颜色选择器包括在设置的外部,但它与任何元素都没有关系

2 个答案:

答案 0 :(得分:1)

您不是在架构中而是在液体本身中创建关系。

正确的语法是:

SELECT *
FROM YourTable 
GROUP BY `part number`, serial_number
ORDER BY id

然后您可以执行以下操作:

{ "type": "text", "id": "title", "label": "Heading", "default": "Image with text overlay" }, { "type": "color", "id": "color_title", "label": "Heading color", "default": "#FFFFFF" }

答案 1 :(得分:0)

 "settings": [ {
   "type": "color",
   "id": "user_color",
   "label": "Color",
   "default": "#000"
 },
] 

然后在schema标签外,输出颜色给shopify:

<h2 style="color: {{ section.settings.user_color }}">Kols might be the king</h2>

user_color 是颜色选择器的 id。 此语法以黑色输出 Kols might be the king 文本,这是架构设置中的默认颜色。