Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function guiCreateColorLabel ( ax, ay, bx, by, str, relative, parent )
- local pat = "(.-)#(%x%x%x%x%x%x)"
- local s, e, cap, col = str:find(pat, 1)
- local last = 1
- while s do
- if cap ~= "" and col then r, g, b = tonumber( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ),
- tonumber( "0x"..col:sub( 5, 6 ) ) )
- end
- last = e + 1
- s, e, cap, col = str:find( pat, last )
- end
- if r == nil then r = 211 end
- if g == nil then g = 211 end
- if b == nil then b = 211 end
- if last <= #str then
- cap = str:sub( last )
- string = string.gsub(cap,'%x%x%x%x%x%x','')
- label = guiCreateLabel ( ax, ay, bx, by, string, relative, parent )
- guiLabelSetColor ( label, r, g, b )
- return label
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment