View Full Version : ~ Usernames Appearance ~
MrPeace
04-02-2007, 03:04 PM
Hi All,
I was wondering if there was any way in which i could make the username with each letter differant colors..? I had a look at it and couldnt think of a way of doing this, if any of you guys know of a way or can produce a way i would greatly appreciate it.
Thanks.
WetWired
04-02-2007, 03:33 PM
Only way I can think of is javascript that looks for certain markup and adds its own.
MrPeace
04-03-2007, 04:28 AM
Only way I can think of is javascript that looks for certain markup and adds its own.
Thanks for replying m8.... how exactly would that work tho ? im pretty new when it comes to working with javascript
WetWired
04-03-2007, 12:47 PM
Myself, I've never written anything like that, but what you need to do is put something like <span class="rainbow"></span> as the markup for the usergroup, then have javascript that runs at the end that does a document.getElementsByTagName("span") to get all the spans, then itterate through them. For each one with className="rainbow", you'd retrieve the innerHTML, break it into letters, add the color markup, and write it back.
Again, I'm a novice when it comes to JS, especially the string stuff you'd need to use; if what I've given you isn't enough, you'll need to find other help.
cOuNtErFiET
04-10-2007, 06:56 AM
i know what your talking about chris and yea i was wondering the same thing
so far i havent found a way but im still looking, i see it a lot on the ipb board but havent seen it yet on a vb board
EDIT: found out how and got it working on my board!
magnus
04-10-2007, 05:19 PM
Well, no.. this could be done in PHP, too.
<?
$colors = array(
'a' => 'red',
'b' => 'blue',
'c' => 'green',
'd' => '#CFCFCD',
etc ..
);
$input = 'abcdefghi..';
$letters = preg_split('//', $input -1, PREG_SPLIT_NO_EMPTY);
foreach($letters as $letter)
{
echo '<span style="font-color:' . $colors[$letter] . '">' . $letter . '</span>';
}
?>
Just an example, but it could be expanded on.. for example, make it a function and just call it whenever you want it.
function omgcolors(text)
{
$letters = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY);
foreach($letters as $letter)
{
$output .= '<span style="font-color:' . $colors[$letter] . '">' . $letter . '</span>';
}
return $output;
}
Then you could just call it when needed.
ie.
omgcolors($bbusername);
Si...
04-10-2007, 05:44 PM
Or you could use HTML. Depends. Do you want it on everyones username? Or just yours?
Oh and using html like that is not recommended... But its an idea.
Some Random Text
captainron19
04-10-2007, 05:46 PM
On somewhat of a same note, is it possible to have usernames all show in a specific font? I have an odd font that a lot of people most likely do not have on their computer so I was wondering if it is possible if they do not have it loaded.
Si...
04-10-2007, 05:48 PM
It may possible to Embed a font. But I couldn't tell you how to do that.
MrPeace
04-12-2007, 06:54 PM
Or you could use HTML. Depends. Do you want it on everyones username? Or just yours?
Oh and using html like that is not recommended... But its an idea.
Some Random Text
No i would make it for a specific usergroup and hopefully be able to make others for differant usergroups
cOuNtErFiET
04-16-2007, 06:42 PM
you have the code for what you want im assuming, once you have that all you have to do is go in and change the amount of chars you can post in the prefix and in the suffix for the usergroup, because what your wanting to do is something like i have below (im assuming) will require more chars than allowed by default...so here is what i have on my board below in my usergroup markup
https://vborg.vbsupport.ru/external/2007/04/13.jpg
p.s. to change the char amount, i went in via cpanel and went to the usergroup table i believe and in there you will be able to change the char limit in the db... you could run a query to change it but i felt more comfortable me changing it instead of running a query, so if you want to run a query it is posted in another post on here (http://www.vbulletin.com/forum/showthread.php?p=1339821)
oh btw yw considering our past!!!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.