Shopware 6 如何在 scss 中使用配置的主题原色?

Shopware 6 How can I use the configured primary colour of the theme in scss?

在管理的主题设置中,我可以设置主色和辅助色。 如何在主题 scss 中使用这些颜色?我已经查看了文档,但只能找到 how to add config values as scss,但找不到已经存在的颜色和它们的名称。

有两种方法可以找出变量的名称:

  1. 在scss中寻找变量的默认值。默认值在 vendor/shopware/storefront/Resources/app/storefront/src/scss/skin/shopware/abstract/variables/_theme.scss 中定义,其中列出了可以在管理中配置的值的变量。
  2. 可以配置的字段在theme.json. For the default theme this is located in vendor/shopware/storefront/Resources/theme.json. Look for the keys in config.fields中定义。

因此,对于原色和副色,变量名称是 $sw-color-brand-primary and $sw-color-brand-secondary