1. #1

    [Colouring in an addon] Need help

    So.. im trying to add some colours to my Aurora mod to match my UI more, but.. im not sure how to work out the numbers i need for the colours.

    f:SetBackdropColor(0, 0, 0, a or alpha)

    thats the line im editing, the numbers seem to be from 0 - 1 (Eg like 0.3) or somthing. im guessing how its how much red blue and green does into it but im not 100% how to work it out. Im trying to add the colour #121212 to it but im getting some issues can anyone help?

  2. #2
    The 0's are the RGB values.

    #121212 in hex, is 18, 18, 18 in RGB.

    If you add a digit at the start, you should also be able to control it's alpha. Then again, I'm no addon coder.
    Last edited by Cowt; 2011-08-21 at 06:54 PM.

  3. #3
    Quote Originally Posted by Cowt View Post
    The 0's are the RGB values.

    #121212 in hex, is 18, 18, 18 in RGB.
    would it be f:SetBackdropColor(18, 18, 18, a or alpha) or be f:SetBackdropColor(0.18, 0.18, 0.18, a or alpha)? :P im thinking its just 18.18.18 tho

  4. #4
    Deleted
    Nope. Hex color values are in a #RRGGBB format - every color value goes from 00 (decimal 0) to ff(decimal 255).

    You first need to convert the value to a decimal format (16 + 2 = 18), then divide it by 255 (the maximum for the hexadecimal color scale) to get the 0-1 scale value to use in SetBackdropColor.

    In your example, the proper call would be
    Code:
    f:SetBackdropColor(18/255,18/255,18/255,a or alpha)
    Or if you don't care about extremely-exact precision, you can simply use
    Code:
    f:SetBackdropColor(0.07,0.07,0.07,a or alpha)

  5. #5
    Right, sorry. The digits are the RGB values in percentages.

    RGB values go to 255. So 18 would be 7%, and written as 0.07 (assuming it accepts two decimals).

    f:SetBackdropColor(0.07, 0.07, 0.07, a or alpha)

    or

    f:SetBackdropColor(0.1, 0.1, 0.1, a or alpha)

    Thanks Treeston.

  6. #6
    Oh ty ^^ i think i understand now , Now i can make the colours what i really want :P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •