XF 2.2 How to include style's colors within BBcode?

Alan_SP

Active member
I made custom BBcode, that includes some colors that are hardcoded, but I'd like to include style colors, so the look of BBcode changes with style.

How do I use style colors, like this @xf-paletteColor4, how to call this color within HTML replacment?
 
Last edited:
Actual BBcode:

HTML:
<fieldset style="width: 95%; margin: auto; border: 3px solid orange; background-color: #353635; padding: 20px;">
<legend style="border: 3px solid orange; padding: 10px; color: orange; background-color: black;">
<b>{option}</b></legend>{text}</fieldset>

Now colors are hardcoded, but I'd like to use XenForo's style variables, so BBcode would function with every style.
 
@Brogan

Can you help me with this, please?

I'd like to use XenForo style variables within BBcode, so it isn't hardcoded, like it is now. So it can work with different styles.

Do I need to put it in {} brackets, like this: {@xf-paletteColor4}? Or how to get it working?
 
For Xenforo 2 you can use it with code like this:
Code:
<style>
h1 {
color: {{ property('paletteAccent1') }};
}
In this case text inner h1-tag use the color "paletteAccent1".

I think that helps you to find your solution. :)
 
Thanks, will test it and report if it is solution.

EDIT: for some reason it didn't work. I'm trying to use it directly within BBcode. Maybe I should work like calling css, or less.

Or maybe @Brogan would have better solution.

I tried with something like this:

HTML:
<fieldset style="width: 95%; margin: auto; border: 3px solid orange; background-color: #353635; padding: 20px;">
    <legend style="border: 3px solid orange; padding: 10px; color: orange; background-color: {{ property('paletteColor5') }};">
    <b>{option}</b></legend>{text}</fieldset>
 
Last edited:
Top Bottom