MyBB Community Forums

Full Version: Background image/color
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here are two MyCodes I just came up with.

One is to add a background color to text, the other is to add a background image to text.

Background Color
Name:
Background Color

Regular Expression:
\[bg=(.*?)\](.*?)\[/bg\]

Replacement:
<span style="background-color: $1;">$2</span>

Output:
[attachment=17495]

Background Image
Name:
Background Image

Regular Expression:
\[bg color=(.*?) image=(.*?) position=(.*?) (.*?) repeat=(.*?) padding=(.*?)\](.*?)\[/bg\]

Replacement:
<span style="background: $1 url($2) $3 $4 repeat-$5;padding: $6;">$7</span>

Output:
[attachment=17496]
Nice. Thanks.
Cool but I won't be using it Toungue.
Lol, whats the point of having an image and a color?
Like if I used the thead image, it would just keep repeating itself. So you can set a background color with it and make it just repeat x direction and it would be like the regular .thead.
Dam i made this but its all in one Sad
Only if i knew it already existed =\
Nice one Joshee,very useful Smile.
Btw can u add a option for text-color using the first example?
background-color + text-color.
Thx in advanced.
\[bg=(.*?) color=(."?)\](.*?)\[/bg\]
<span style="background-color: $1;color: $2;">$3</span>

Should work.