简体   繁体   English

使用常量编辑器 TYPO3 更改 css 颜色变量

[英]change css color variable with constant editor TYPO3

I currently have multisites on typo3 and I want to set up a system to change the color of each site via constant editor.我目前在 typo3 上有多个站点,我想建立一个系统来通过常量编辑器更改每个站点的颜色。

For this I created color variables on my CSS file for example:为此,我在 CSS 文件上创建了颜色变量,例如:

root {
  --first: # 007bff;
  --second: # 6610f2;
}

here is how I set it all up:这是我如何设置的:

my constants file:我的常量文件:

skin {

    # customsubcategory = site = Param Site
    site {
        # cat = skin / site / 1; type = string; label = title detail news
        newsSuffixHeadTitle = Poppy

        # cat = skin / site / 2 type = color; label = first color
        firstcolor = var (--first)

         # cat = skin / site / 3 type = color; label = second color
         secondcolor = var (--second)
    }

my setup file:我的设置文件:

page.cssInline.10 = TEXT
page.cssInline.10.value (
.theme1 .container-nav .content-nav .theme1 .container-nav .menu-responsive {background: {$ skin.site.firstcolor}}

.theme1 .container-carousel-communes .b-title-item h3 {color: $ skin.site.secondcolor})

and on constant editor, I use var (--first) and var (--second) to apply my colors on the css, however it is not a good method in my opinion在常量编辑器上,我使用 var (--first) 和 var (--second) 在 css 上应用我的 colors,但是在我看来这不是一个好方法

I wish I could choose the colors directly via constant editor, but I don't know enough about it to do this, do you have any ideas please?我希望我可以直接通过常量编辑器选择colors,但是我对此不太了解,请问您有什么想法吗?

Thank you谢谢

You can't access CSS constants from TYPO3 constants.您无法从 TYPO3 常量访问 CSS 常量。 CSS constants actually only work with extensions like SCSS or SASS, and are only used when compiling extended CSS to CSS. CSS constants actually only work with extensions like SCSS or SASS, and are only used when compiling extended CSS to CSS.

Assign your values to the TYPO3 constants directly, like this:将您的值直接分配给 TYPO3 常量,如下所示:

skin {

    # customsubcategory = site = Param Site
    site {
        # cat = skin / site / 2 type = color; label = first color
        firstcolor =  #007bff;

         # cat = skin / site / 3 type = color; label = second color
         secondcolor = #6610f2;
    }

I guess there should be no space after the #.我猜#后面应该没有空格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM