View Full Version : New BB tag to do rainbow text...
This is a fairly simple hack that allows you to create a new BB tag to do
rainbow colors with text. It is only a few lines and the only file affected
by it is admin/functions.php.
You can see a sample output in this thread: http://www.ls1.com/forums/showthread.php?s=&threadid=225576
Note1: This hack has been done and tested on VB 2.2.9
Note2: Using other BB tags within the rainbow tags will convert the underlying HTML code in to rainbow text. :D
Note3: You can find the revised and BB code friendly version in this post (https://vborg.vbsupport.ru/showthread.php?postid=340386#post340386)
Note4: You can find the version that displays the full spectrum of colors in this post (https://vborg.vbsupport.ru/showthread.php?postid=342116#post342116).
Chris M
01-08-2003, 07:19 PM
Looks good;)
Satan
Floris
01-08-2003, 07:41 PM
Please add your hack in a .txt file rather then showing it like this. Thank you.
DrkFusion
01-08-2003, 08:59 PM
Hehe cool little hack :)
Drkfusion will install this
vdinh
01-08-2003, 09:52 PM
Cool hack :) ... However, I have some problem with some unicode characters. They will show as #xxxx, not as the real unicode charaters. Would you please point out what should I do ?
bitbender
01-09-2003, 03:14 AM
* bitbender *clicks install* - clean as a whistle on my 2.2.6 :)
Originally posted by vdinh
Cool hack :) ... However, I have some problem with some unicode characters. They will show as #xxxx, not as the real unicode charaters. Would you please point out what should I do ?
I wonder if you can point me to a thread in your forums so that I can see what you are seeing. :)
Boofo
01-09-2003, 06:23 AM
Zzed, I figured out how to take the black background out but how do I make the rainbow text the same size that is set for the message? It is bigger than the regular message text.
Great hack, by the way. :)
Originally posted by Boofo
Zzed, I figured out how to take the black background out but how do I make the rainbow text the same size that is set for the message? It is bigger than the regular message text.
Great hack, by the way. :)
Thank you Boofo. :)
Here is how you fix the font size. ;)
Change this line in dorainbow()
$buffer .= "<font color=\"$color\">";
To this:
$buffer .= "<font color=\"$color\" face=\"verdana,arial,helvetica\" size=\"2\">";
Boofo
01-09-2003, 07:04 AM
That was quick. Thank you. :)
Here is what I changed to make the background transparent.
$buffer = "<table><tr><td bgcolor=\"\">";
It works, but is it the correct way to do it? :)
corsacrazy
01-09-2003, 07:39 AM
is there a way to add this using the bb code adding option in the acp or do i have to edit my functions :(
Boofo, You can actually leave out the bgcolor stuff and just use <td> by itself. ;)
corsacrazy, unfortunately to the best of my knowledge this is the only way to do it. :(
corsacrazy
01-09-2003, 07:48 AM
Originally posted by Zzed
corsacrazy, unfortunately to the best of my knowledge this is the only way to do it. :(
k cheeres ! ill give it a go !
Boofo
01-09-2003, 08:16 AM
Originally posted by Zzed
Boofo, You can actually leave out the bgcolor stuff and just use <td> by itself. ;)
DOHH!!! :) I figured that out after I wrote the message. Sorry about that. The size change works great but I can not change the size of the text to anything else within the message now for some reason. :(
sphinx
01-09-2003, 09:33 AM
very nice m8
bitbender
01-09-2003, 02:04 PM
Here is one example...
User name to log with: bit_user2
password: testme
Link to Thread in question (http://www.bitbenderforums.com/vb22/showthread.php?postid=226199#post226199)
Originally posted by bitbender
Here is one example...
User name to log with: bit_user2
password: testme
Link to Thread in question (http://www.bitbenderforums.com/vb22/showthread.php?postid=226199#post226199)
Ok, I assume you are talking about post #2 in that thread. I made a note in my original post that using BB code inside the rainbow tags will end up displaying the underlying HTML code, which is what you are seeing in there.
I can probably fix it. But it is not something that I can do any time soon. :(
nymyth
01-09-2003, 04:25 PM
i installed this hack, but i dont see anything.......whats going on??
Peace
ps..i mean is there supposed to be an option that u press like php/list etc??
Silenced Soul
01-09-2003, 04:44 PM
heh, pretty cool. I'll install it just for fun. :P
bitbender
01-09-2003, 04:48 PM
I can probably fix it. But it is not something that I can do any time soon
Ok, I understand.. I wondered if I read past it before.... and I did..sorry.
nymyth
01-09-2003, 04:49 PM
well the code works....when i put in [ rainbow]text here[ /rainbow]
my question is do i have to do this manually each time....????or is there a drop down menu im missing??
Peace
KuraFire
01-09-2003, 04:52 PM
oh god....
*winces*
What a lovely idea.. make the sourcecode of already huge threads even twice as big! :up:
Use five hundred font tags in a page! :up:
Double your bandwidth usages if people use your lovely (</sc>) hack! :up::up:
ugh...
(sorry, just felt like pointing that out ^_^)
Areku
01-09-2003, 08:10 PM
Originally posted by DrkFusion
Hehe cool little hack :)
Drkfusion will install this
Can you, DarkFusion, or anyone, explain me how to get the rainbow to act like HERE and not like the original hack? the original hack is lack of green and blueish colors of the rainbow...
Tu!
Ok, here is the BB code friendly version. ;)
Note: If you have installed the original version, you need to back out of it and replace it with this one.
I made a couple of changes to this - I didn't much like the black background, so I went for the dark glow option. (See attached screenshot)
To use glow like I did, simply modify the code from the hack in the first post:
Find (in functions.php):
// ###################### Startdorainbow #######################
function dorainbow($code) {
$len = strlen($code);
$buffer = "<table><tr><td bgcolor=\"#000000\">";
$mul = 255/$len;
for($x = 0;$x < $len;$x++) {
$color_h1 = 255*sin($x/($len/3));
$color_h2 = $mul * $x;
$color = sprintf("#FF%02X%02X", $color_h1, $color_h2);
$buffer .= "<font color=\"$color\">";
$buffer .= substr($code,$x,1);
$buffer .= "</font>";
}
$buffer .= "</td></tr></table>";
return($buffer);
}
And replace with:
// ###################### Startdorainbow #######################
function dorainbow($code) {
$len = strlen($code);
$buffer = "<table style=\"filter:glow(color=black, strength=2)\"><tr><td>";
$mul = 255/$len;
for($x = 0;$x < $len;$x++) {
$color_h1 = 255*sin($x/($len/3));
$color_h2 = $mul * $x;
$color = sprintf("#FF%02X%02X", $color_h1, $color_h2);
$buffer .= "<font color=\"$color\" face=\"Verdana\" size=2><b>";
$buffer .= substr($code,$x,1);
$buffer .= "</b></font>";
}
$buffer .= "</td></tr></table>";
return($buffer);
}
Areku
01-09-2003, 08:51 PM
FAR FAR Much nicer now with the glow effect!
However how do i add the FULL range of colors and not just the red/yellow/pink ones?
Blue and green are missing from the spectrum!!
Originally posted by Areku
FAR FAR Much nicer now with the glow effect!
However how do i add the FULL range of colors and not just the red/yellow/pink ones?
Blue and green are missing from the spectrum!!
No idea!
This code is pretty clever stuff, I can't figure it out!
Areku
01-09-2003, 08:55 PM
What a weirdo!
Full range of colors is active here!!
supercalifragilisticumspialidociousisthewordiuseto testthisrainbowthing
Areku
01-09-2003, 08:56 PM
Oh!
It didn't work!!
DarkFusion, what did u use!? Manually entered that sentence colorfull?
Yes, he did (try quoting his post!)
Areku
01-09-2003, 09:02 PM
I did quote his, still stunned he spent that much time!!
However there must be a way to add blue and green to the rainbow of this hack, isn't it??
There's always a way, but the maths would be more complicated.
Guys, please also check out this post for the BB code friendly version ;)
https://vborg.vbsupport.ru/showthread.php?postid=340386#post340386
DrkFusion
01-09-2003, 09:16 PM
supercalifragilisticumspialidociousisthewordiuseto testthisrainbowthing
Also jsut a reminder to people you will use J.Eovies mod, keep in mind that the glow style can be viewed by users using IE 5.5+ I am not sure about other browsers.
By the way its a secret :speechless:
Areku
01-09-2003, 09:21 PM
So how many $$$ to reveal your trick Dfusion? ;)
Originally posted by DrkFusion
supercalifragilisticumspialidociousisthewordiuseto testthisrainbowthing
Also jsut a reminder to people you will use J.Eovies mod, keep in mind that the glow style can be viewed by users using IE 5.5+ I am not sure about other browsers.
By the way its a secret :speechless:
You my friend are a mean person. :D j/k ;)
DrkFusion
01-09-2003, 09:42 PM
By me a HiveMail Liscense :P and I will reveal to you LOL
Areku
01-10-2003, 11:22 AM
U're too xpensive! ;)
Boofo
01-10-2003, 11:25 AM
Originally posted by DrkFusion
By me a HiveMail Liscense :P and I will reveal to you LOL
As one of the Kirby brothers you could reveal it to me in a pm. ;)
Boofo
01-10-2003, 02:32 PM
Originally posted by Zzed
Ok, here is the BB code friendly version. ;)
Note: If you have installed the original version, you need to back out of it and replace it with this one.
I installed this and the only vbcode it would recognize and use was the FONT code. The size and nothing else works with it. What is the difference between this version and the first version you posted? And is there a way to get the whole color spectrum (like in Drks replies)? Also, is there a way to have it default to the board set font size instead of having to hard code it to size 2?
I found a bit of a flaw in this - when you type in a lot of text, you can see the backslashes for " cancelling and line breaks:
http://www.eovie.com/problem.gif
Nice, won't install it though ;)
Barret
01-14-2003, 03:52 AM
I might install it, thanks!
I went ahead and made a new version that looks like DrkFusion's posts. Here is an example. I will release it in this thread for anyone who is interested.
http://www.ls1.com/forums/showthread.php?postid=2190859#post2190859
Boofo
01-14-2003, 07:23 AM
I'm interested. Send it up, sir. :)
Will they still make the rainbow wider as you add more text or will it start the rainbow effect over again after so much text? The second option would actually be better, if it can be done, that is. :)
nymyth
01-14-2003, 07:24 AM
im interested...how can i get it...thanx
Peace
Originally posted by Boofo
I'm interested. Send it up, sir. :)
Will they still make the rainbow wider as you add more text or will it start the rainbow effect over again after so much text? The second option would actually be better, if it can be done, that is. :)
It widens as your text gets longer. ;)
I will release the hack. :)
KuraFire
01-14-2003, 08:11 AM
omg I'm glad I use Mozilla...
glows... evil... *shudders*
I totally forgot how horrible those look...
Areku
01-14-2003, 03:38 PM
SO, where is it?!?!
Barret
01-14-2003, 06:54 PM
Zzed,
We are waiting man. Glad you are helping with this.
Thanks in advance.
Here is the version with the full spectrum of colors.
This is what the output of the tag looks like: http://www.ls1.com/forums/showthread.php?postid=2190859#post2190859
Enjoy :D
Barret
01-14-2003, 09:19 PM
Zzed,
You are the greatest and I am pleased to be the first to thank you.
Thanks! :)
Clicks install
{{UPDATE}} This hack also is fixed from the previous version where there were a few problems as posted by john.eovie
Here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=47509&perpage=15&display=&pagenumber=3)
Originally posted by Barret
Zzed,
You are the greatest and I am pleased to be the first to thank you.
Thanks! :)
Clicks install
{{UPDATE}} This hack also is fixed from the previous version where there were a few problems as posted by john.eovie
Here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=47509&perpage=15&display=&pagenumber=3)
Thank you for your kind words. https://vborg.vbsupport.ru/
Boofo
01-14-2003, 10:03 PM
Zzed, I couldn't do the new version with the following line:
$bbcode=str_replace("{", "{", $bbcode); // stop people posting replacements in their posts
Because my line for that is this:
// $bbcode=str_replace("{", "{", $bbcode); // stop people posting replacements in their posts
because of another hack. I just changed the "// ###################### Startdorainbow #######################" part and left the first part from version 1 in there instead. It seems to work. ;)
XIanX
01-14-2003, 10:11 PM
Originally posted by Zzed
I went ahead and made a new version that looks like DrkFusion's posts. Here is an example. I will release it in this thread for anyone who is interested.I'm interested. :)
Originally posted by XIanX
I'm interested. :)
LOL, Look at Post #52 (https://vborg.vbsupport.ru/showthread.php?postid=342116#post342116) in this thread. :D
Jack of Xanadu
01-17-2003, 11:19 PM
I did some fine tweaking on the scripts and merged both scripts a little and now it looks awsome:
You can see it in action in here (http://www.fox-community.com/forums/showthread.php?s=&threadid=4656&pagenumber=2)
original script:
// ###################### Startdorainbow #######################
function dorainbow($code) {
$textlen = 0;
$tag = 0;
$len = strlen($code);
for($x = 0;$x < $len;$x++) {
if(substr($code,$x,1) == "\\") {
continue;
}
if($tag == 0) {
if(substr($code,$x,1) == "<") {
$tag = 1;
}
else {
$textlen++;
}
}
else {
if(substr($code,$x,1) == ">") {
$tag = 0;
}
}
}
$buffer = "<table><tr><td bgcolor=\"#000000\">";
$slice = $textlen / 6;
$step = 255 / $slice;
$index = 0;
$R = 255;
$G = 0;
$B = 0;
$section = 0;
$count = 0;
for($x = 0;$x < $len;$x++) {
if(substr($code,$x,1) == "\\") {
continue;
}
if($tag == 0) {
if(substr($code,$x,1) == "<") {
$buffer .= substr($code,$x,1);
$tag = 1;
}
else {
if($section == 0) {
$Rx = 0;
$Gx = $step;
$Bx = 0;
} else if ($section == 1) {
$Rx = (-1) * $step;
$Gx = 0;
$Bx = 0;
} else if ($section == 2) {
$Rx = 0;
$Gx = 0;
$Bx = $step;
} else if ($section == 3) {
$Rx = 0;
$Gx = (-1) * $step;
$Bx = 0;
} else if ($section == 4) {
$Rx = $step;
$Gx = 0;
$Bx = $step;
} else {
$Rx = 0;
$Gx = 0;
$Bx = (-1) * $step;
}
$count++;
if($count > $slice) {
$section++;
$count = 0;
}
$R += $Rx;
$G += $Gx;
$B += $Bx;
$R = iif($R > 255, 255, $R);
$R = iif($R < 0, 0, $R);
$G = iif($G > 255, 255, $G);
$G = iif($G < 0, 0, $G);
$B = iif($B > 255, 255, $B);
$B = iif($B < 0, 0, $B);
$color = sprintf("#%02X%02X%02X", $R, $G, $B);
$buffer .= "<font color=\"$color\">";
$buffer .= substr($code,$x,1);
$buffer .= "</font>";
$index++;
}
}
else {
if(substr($code,$x,1) == ">") {
$tag = 0;
}
$buffer .= substr($code,$x,1);
}
}
$buffer .= "</td></tr></table>";
return($buffer);
}
Replace it with:
// ###################### Startdorainbow #######################
function dorainbow($code) {
$textlen = 0;
$tag = 0;
$len = strlen($code);
for($x = 0;$x < $len;$x++) {
if(substr($code,$x,1) == "\\") {
continue;
}
if($tag == 0) {
if(substr($code,$x,1) == "<") {
$tag = 1;
}
else {
$textlen++;
}
}
else {
if(substr($code,$x,1) == ">") {
$tag = 0;
}
}
}
$buffer = "<table style=\"filter:glow(color=black, strength=6)\"><tr><td>";
$slice = $textlen / 6;
$step = 255 / $slice;
$index = 0;
$R = 255;
$G = 0;
$B = 0;
$section = 0;
$count = 0;
for($x = 0;$x < $len;$x++) {
if(substr($code,$x,1) == "\\") {
continue;
}
if($tag == 0) {
if(substr($code,$x,1) == "<") {
$buffer .= substr($code,$x,1);
$tag = 1;
}
else {
if($section == 0) {
$Rx = 0;
$Gx = $step;
$Bx = 0;
} else if ($section == 1) {
$Rx = (-1) * $step;
$Gx = 0;
$Bx = 0;
} else if ($section == 2) {
$Rx = 0;
$Gx = 0;
$Bx = $step;
} else if ($section == 3) {
$Rx = 0;
$Gx = (-1) * $step;
$Bx = 0;
} else if ($section == 4) {
$Rx = $step;
$Gx = 0;
$Bx = $step;
} else {
$Rx = 0;
$Gx = 0;
$Bx = (-1) * $step;
}
$count++;
if($count > $slice) {
$section++;
$count = 0;
}
$R += $Rx;
$G += $Gx;
$B += $Bx;
$R = iif($R > 255, 255, $R);
$R = iif($R < 0, 0, $R);
$G = iif($G > 255, 255, $G);
$G = iif($G < 0, 0, $G);
$B = iif($B > 255, 255, $B);
$B = iif($B < 0, 0, $B);
$color = sprintf("#%02X%02X%02X", $R, $G, $B);
$buffer .= "<font color=\"$color\" face=\"Verdana\" size=2><b>";
$buffer .= substr($code,$x,1);
$buffer .= "</font>";
$index++;
}
}
else {
if(substr($code,$x,1) == ">") {
$tag = 0;
}
$buffer .= substr($code,$x,1);
}
}
$buffer .= "</td></tr></table>";
return($buffer);
}
Boofo
01-18-2003, 07:51 AM
LOL That was already done (with a little less glow effect, which looks better) in the beginning of the thread. What else was changed, maybe I missed it?
Areku
01-18-2003, 10:21 AM
The one with glow effect at the beginning of the thread was NOT having the full spectrum of colours ;)
Thanks Jack! ;)
Robink
02-07-2003, 06:28 AM
I always get the error "Division by zero" :(
Robink
02-07-2003, 06:29 AM
In particular it sayd this:
Warning: Division by zero in /home/virtual/site13/fst/var/www/html/forums/admin/functions.php on line 844
I tried both versions of the hack :(
Classy
04-06-2003, 11:31 PM
Nice addition :D Installed and works on 2.3.0
Clicked install :D Thank you
02-07-03 at 01:29 AM Robink said this in Post #62 (https://vborg.vbsupport.ru/showthread.php?postid=351385#post351385)
In particular it sayd this:
Warning: Division by zero in /home/virtual/site13/fst/var/www/html/forums/admin/functions.php on line 844
I tried both versions of the hack :(
Please Email me a copy of your functions.php.
My Email is: edwink@seebeyond.com
MooMan65
04-30-2003, 02:52 AM
I get a division by zero error every time someone types in without anything in it. The error only appears on the page at which it's typed but doesn't go away, it just accumulates over time. Otherwise the hack works perfectly, but it's that error which is stopping me from installing it, as not all members are kind enough to NOT type it in. :( And way to stop this?
I will correct the bug and post a fix. I'll do that later tonight.
I have fixed all the attached versions for the "division by zero" error. ;)
Boofo
04-30-2003, 08:53 AM
Today at 04:48 AM Zzed said this in Post #67 (https://vborg.vbsupport.ru/showthread.php?postid=389298#post389298)
I have fixed all the attached versions for the "division by zero" error. ;)
I'm still using version 1 with the code in the functions.php. What would be the fix for that?
I fixed all 3 versions. ;)
In function dorainbow()
Look for:
$len = strlen($code);
Add this directly below it:
if($len == 0) {
return($code);
}
lioncool1589
09-08-2003, 11:46 PM
would be nice if user can change diff color
Zachery
03-13-2004, 06:25 AM
would be nice if user can change diff color
Wow old, but Zzed will you be making an updated version to vB3?
rebelsrock06
03-20-2004, 11:52 PM
Wow old, but Zzed will you be making an updated version to vB3?
id really really love to have this for VB3
Ill beg if i have to
sabret00the
05-08-2004, 02:10 PM
me too :)
msimplay
05-08-2004, 02:13 PM
me 3
LMAO I always end up in the wanting the same things as Sabertoothe :p
sabret00the
06-03-2004, 04:32 PM
*bump*
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.