Thread Tools Display Modes
09-01-09, 03:14 PM   #1
sakurakira
A Chromatic Dragonspawn
 
sakurakira's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 151
defining colors...

I was looking in an addon to define bar colors (mainly for the default UI), and I was quite confused about the different numbers. In the same line of code, there are two different number types used. Is this developer error, him taking a shortcut (ie laziness), and can I redo all of the numbers to the same format?

Here is a sample...

Code:
PowerBarColor["MANA"] = { r = 0/255, g = 0.6, b = 1 }   -- r = 0/255, g = 150/255, b = 1900/255
PowerBarColor["ENERGY"] = { r = 1, g = 1, b = 35/255 }
I understand #/255. Looking at colors in Photoshop or MS Paint explains those. I do not however, understand the decimal number.
__________________
Arise, my champion!
  Reply With Quote
09-01-09, 03:20 PM   #2
Starinnia
Ninja Code Monkey
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 84
The decimal is the same as the fraction, but without the CPU time spent calculating it.

so .6 is 153/255

If you put 153/255 in the code though, the computer must calculate the value of that fraction. Putting .6 eliminates that calculation
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » defining colors...


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off