Multicolouring words/names

Posted by NeoFryBoy on Sat 15 Jul 2006 11:26 PM — 2 posts, 12,330 views.

USA #0
Well, I was tired of having just one colour for my name so I decided to make a set of triggers that do a dual colour scheme, and show it to people with some explanation.

Essentially you could use this concept and the basic regexp syntax here to create an alternating colour name which colours every letter a different colour.

Basically this is one trigger set to fire off with a sequence of one, and colour my name 'tealos' or the shortened version (some people use ' 'los' or ' los') red.

So this one matches on (tea|')los and ignores case, repeats on line, etc.

The second one is the tricky bit. What it does is looks for tealos, 'los, or los and colours only the los part a different colour.

The match for this is: (?<=tea|'| )los(?=[,\s.'?>:]\*\!])

Explanation on the expression:
(?<= - This is called a pos lookbehind assertion. It matches when any word begins with what's in the pattern, but (this is the important part) doesn't include that pattern in the match.

los - The only part that isn't wrapped in assertions, so it will be what's coloured.

(?=[,\s.'?>:]\*\!]) - All this crap is basically the same as the first. Since we don't want it to match on lost or lose it simply defines what characters may follow my character's name (\s is a space, etc.), but doesn't try to colour them in. It uses a character class, but you could use |'s over and over.)


<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="(?&lt;=tea|'| )los(?=[,\s.'?&gt;:\]\*\!])"
   regexp="y"
   repeat="y"
   sequence="50"
   other_text_colour="maroon"
  >
  </trigger>
  <trigger
   custom_colour="7"
   colour_change_type="1"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="(tea|')los"
   regexp="y"
   repeat="y"
   sequence="1"
   other_text_colour="#FF0080"
  >
  </trigger>
</triggers>
USA #1
Alternation at it's finest.

On a further note I was able to make a second trigger set that only goes off when it sees the word tea followed by a space, period, colon, etc.

This one alternates colours, and goes from red to maroon back to red.


<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="(?&lt;=t)e(?=a[,\s.'?&gt;:\]\*\!])"
   regexp="y"
   repeat="y"
   sequence="100"
   other_text_colour="maroon"
  >
  </trigger>
  <trigger
   custom_colour="17"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="(?&lt;=te)a(?=[,\s.'?&gt;:\]\*\!])"
   regexp="y"
   repeat="y"
   sequence="100"
   other_text_colour="red"
  >
  </trigger>
  <trigger
   custom_colour="17"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="t(?=ea(?=[,\s.'?&gt;:\]\*\!]))"
   regexp="y"
   repeat="y"
   sequence="100"
   other_text_colour="red"
  >
  </trigger>
</triggers>


Note: this... t(?=e)a(?=l)o(?=s) doesn't match tealos