Geyser label text color

Post Reply
User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Geyser label text color

Post by Akaya »

I keep struggling with this. Some days I'm successful only for it to break moments later...

I want to set the text color on a Geyser label using rgb format in such a way that the rgb values are stored in variables so I can easily change them.

Here's my attempt to do so in the stylesheet to no avail:
Code: [show] | [select all] lua
redv = 255
greenv = 0
bluev = 0

mylabel = Geyser.Label:new({
  name="mylabel",
  x=0,y=0,
  width="10%",height="10%",
})
mylabel:setStyleSheet([[
  color: rgb("..redv..","..greenv..","..bluev..");
]])
mylabel:echo("hello world")
Here's my attempt to do so with the decho() function. Didn't work either. I've heard from some that this function works and from others that it does not.
Code: [show] | [select all] lua
mylabel:decho("<"..redv..","..greenv..","..bluev..">Hello World")

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Geyser label text color

Post by Vadi »

Try:
Code: [show] | [select all] lua
redv = 255
greenv = 255
bluev = 0

mylabel:echo(string.format("<span style='color: rgb(%d,%d,%d)'>Hello World</span>", redv, greenv, bluev))

User avatar
kevutian
Posts: 217
Joined: Fri Aug 20, 2010 8:18 pm
Location: United Kingdom
Contact:

Re: Geyser label text color

Post by kevutian »

Yeah. I've never even bothered trying decho()

I use it like this:
Code: [show] | [select all] lua
local out = [[<p align="center" style="font-size: 11px; font-family: 'Monospace'">]] .. "<span style=\"color:OrangeRed\">" .. table.concat(mobs, "<br>") .. "<br /></span><span style=\"color:gold\">" .. table.concat(important, "<br />") .. "<br /></span><span style=\"color:PapayaWhip\">" .. table.concat(other or others, "<br />") .. [[</span></p><br>]]

ui.labels.roomitems:echo(out)

User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Re: Geyser label text color

Post by Akaya »

Awesome! Got it working using that html tag. Here it is in action using my numpad to change the rgb values:
http://youtu.be/aEO82CCjdPE

Thanks!

Post Reply