SFFNetwork
Member
I have an idea whereby I can allow users to enter a color into a custom user field, and then feed this color into css statements, which will consequently give elements (of my choice) the color specified by the user. In this way I can allow users to create basic "custom" themes while ensuring that any such themes remain usable/accessible.
Creating the custom field and referencing it in a XenForo template is simple enough, but I'm hitting a roadblock since I know that XF variables can't be referenced in CSS or LESS. I feel that there must be some clever way to achieve this end result, but I haven't been able to come up with it, and other examples of folks using custom fields to control styles focused more on adding/removing sections with if statements, rather than changing how elements are styled with CSS. For instance:
Is what I'm trying to do possible, or is the behavior not possible with custom user fields and template code alone?
Creating the custom field and referencing it in a XenForo template is simple enough, but I'm hitting a roadblock since I know that XF variables can't be referenced in CSS or LESS. I feel that there must be some clever way to achieve this end result, but I haven't been able to come up with it, and other examples of folks using custom fields to control styles focused more on adding/removing sections with if statements, rather than changing how elements are styled with CSS. For instance:
Code:
<xf:if is="{$user.Profile.custom_fields.showcontentbool}">
<- content goes here ->
</xf:if>
Is what I'm trying to do possible, or is the behavior not possible with custom user fields and template code alone?