MyBB Community Forums

Full Version: Define new colors for [color]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So my users could type, for example,
[color=cien]text[/color]
instead of
[color=#996633]text[/color]
I don't even know how to go about doing this.
That already works, you just spelled cyan wrong.
(2023-08-21, 10:24 PM)Nathan Malcolm Wrote: [ -> ]That already works, you just spelled cyan wrong.

I was not trying to spell cyan. I want do define new colors.
(2023-08-20, 11:44 AM)ArtemidaForum Wrote: [ -> ]So my users could type, for example,
[color=cien]text[/color]
instead of
[color=#996633]text[/color]
I don't even know how to go about doing this.

I haven't checked but couldn't something like this work?

<span class="cien">text</span>

and in the global css for the theme add

.cien {
  color: #996633;
}

You would need to add the css for each 'word' you wanted!
You can define custom color names with some hex codes in css or you can define it in the MyCode editor, separate BB code for each color.

Example:

regexp:
Quote:\[cien\](.*?)\[/cien\]

replacement:
Quote:<span style="color:#996633">$1</span>

So your users have just to type in the post:
Quote:[cien]Cuckoo[/cien]

But firstly they have to know the names of the custom colors that you added and  to understand the match between the names and the colors.