7 17, 2020 5:57 AM
Is it possible to access settings of the theme within a module?
I seem to be having issues when using settings at a module level which are in the theme..
This works outside of a module but not inside of a module
{{ theme.global_colors.additional_1_color.color }}
7 19, 2020 9:59 AM
Hey
Any use case of why you would want to use this in a module 🙂
If you want dynamically set the color may be target it using a class?
7 19, 2020 11:02 AM
Well, if I want for instance a title module to use a preset colour from the Theme defaults.
If I can't access the color from the theme settings then creating a class isn't going to be much help either is it?
Can you elaborate on how you think creating a class might help?
Please consider the fact that I may want to use this color on a background-color, color, or border color.
7 19, 2020 11:10 AM
So all default headers(h1,h2,h3 etc. ) and titles tags can be set.If you are using any of those it should work automatically if not the class would come in handy
you can set the colors you want in a specific class.
For ex:
.custom-class{
color: {{ color_var }};
background-color:{{ bg_color }}
border-color:{{ theme.buttons.border_color }}
}
7 19, 2020 11:19 AM - 編集済み 7 19, 2020 11:20 AM
I see what you're saying.
Essentially, I'd need to create seperate classes though for each of the properties.
.theme-primary-bg-color{ background-color: {{ theme.colors.primary }} } .theme-primary-color{ color: {{ theme.colors.primary }} } .theme-primary-border-color{ border-color: {{ theme.colors.primary }} } .theme-secondary-bg-color{ background-color: {{ theme.colors.secondary}} } .theme-secondary-color{ color: {{ theme.colors.secondary}} } .theme-secondary-border-color{ border-color: {{ theme.colors.secondary}} }
Although slightly longwinded, it could work
7 20, 2020 12:13 AM
I just tried accessing the colors in module i was able to.
Syntax:
7 20, 2020 3:40 AM
That's right!
Thanks for your help.
I found out over the weekend that CSS files can't utilise variables within a module.
Which makes complete sense considering you wouldn't be able to have 2 of the same module with different colour referenced in a CSS file. Just doesn't make sense and I don't actuall know what I was thinking tbh