WoW LibColors-1.0 addon Dragonflight/Wrath of the Lich King Classic 2025
logo
wow addon LibColors-1.0

LibColors-1.0

Game Version: 10.0.5 +2
Total Downloads: 9,545
Updated: Jan 26, 2023
Created: Aug 13, 2014
download LibColors-1.0Download Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
r113 release 28.02 KB Jan 26, 2023 10.0.5 +2 149 download LibColors-1.0 r113 releaseDownload
r112 release 28.13 KB Oct 25, 2022 10.0.2 +2 280 download LibColors-1.0 r112 releaseDownload
r111 release 28.13 KB Sep 19, 2022 9.2.7 +2 161 download LibColors-1.0 r111 releaseDownload
r110 release 28.03 KB Jun 3, 2022 9.2.5 +2 602 download LibColors-1.0 r110 releaseDownload
r109 release 14.18 KB Mar 14, 2022 9.2.0 +2 172 download LibColors-1.0 r109 releaseDownload
1.0.23-release +1 More release 25.52 KB Nov 3, 2021 1.14.0 +2 229 download LibColors-1.0 1.0.23-release
+1 More releaseDownload
1.0.22-release +1 More release 24.73 KB Jun 30, 2021 9.1.0 235 download LibColors-1.0 1.0.22-release
+1 More releaseDownload
1.0.21-release release 13.38 KB Mar 11, 2021 9.0.5 278 download LibColors-1.0 1.0.21-release releaseDownload
1.0.20-release release 13.36 KB Feb 11, 2021 9.0.2 242 download LibColors-1.0 1.0.20-release releaseDownload
1.0.19-release release 9.31 KB Jan 18, 2021 9.0.2 221 download LibColors-1.0 1.0.19-release releaseDownload
1.0.18-release +1 More release 24.71 KB Nov 19, 2020 9.0.2 183 download LibColors-1.0 1.0.18-release
+1 More releaseDownload
1.0.17-release +1 More release 24.71 KB Oct 18, 2020 9.0.1 153 download LibColors-1.0 1.0.17-release
+1 More releaseDownload
1.0.16-release +1 More release 24.71 KB Oct 29, 2019 8.2.5 263 download LibColors-1.0 1.0.16-release
+1 More releaseDownload
1.0.15-Release +1 More release 24.71 KB Jun 25, 2019 8.1.5 255 download LibColors-1.0 1.0.15-Release
+1 More releaseDownload
1.0.14-release +1 More release 24.73 KB May 23, 2019 8.1.5 154 download LibColors-1.0 1.0.14-release
+1 More releaseDownload
1.0.13-release +1 More release 24.70 KB May 18, 2019 8.1.5 132 download LibColors-1.0 1.0.13-release
+1 More releaseDownload
1.0.12-release +1 More release 24.82 KB Apr 25, 2019 8.1.5 231 download LibColors-1.0 1.0.12-release
+1 More releaseDownload
1.0.9-Release3 +1 More release 24.65 KB Mar 17, 2019 8.1.5 226 download LibColors-1.0 1.0.9-Release3
+1 More releaseDownload
1.0.11-release +1 More release 24.89 KB Jul 18, 2018 8.0.1 402 download LibColors-1.0 1.0.11-release
+1 More releaseDownload
1.0.10-release +1 More release 13.39 KB Sep 4, 2017 7.3.0 381 download LibColors-1.0 1.0.10-release
+1 More releaseDownload
1.0.9-Release2 release 16.06 KB Mar 27, 2017 7.2.0 275 download LibColors-1.0 1.0.9-Release2 releaseDownload
1.0.9-Release1 +1 More release 16.22 KB Jun 24, 2015 6.2.0 537 download LibColors-1.0 1.0.9-Release1
+1 More releaseDownload
1.0.8-Release2 +1 More release 16.24 KB Feb 26, 2015 6.1.0 270 download LibColors-1.0 1.0.8-Release2
+1 More releaseDownload
1.0.8-Release +1 More release 16.24 KB Dec 24, 2014 6.0.3 213 download LibColors-1.0 1.0.8-Release
+1 More releaseDownload
LibColors-1.0-r107 release 9.99 KB Aug 14, 2014 6.0.1 411 download LibColors-1.0 LibColors-1.0-r107 releaseDownload

Description

Share this:

Short description

A library to easy coloring strings by hex codes, color tables, class names, color names and more.

Supported types

  • hex code with 8 and 6 characters. [<alpha>]<red><green><blue> like 9E342C (alpha is optional)
  • color table in two variants: { <red[number]>, <green[number]>, <blue[number]>, <alpha[number](optional)> } or { [“r”] = <{ <red[number]>, [“g”] = <green[number]>, [“b”] = <blue[number]>, [“a”] = <alpha[number](optional)> }
  • class names supports english and localized names on non english clients
  • ITEM_QUALITY_COLORS as quality[number] and lower string version of ITEM_QUALITY[number]_DESC
  • or keywords
    • playerclass will be relaced with the current players class color
  • second parameter must not be a string to coloring it
    • not set second parameter returns hex color code
    • the string “colortable” as second parameter returns the requested color as color table

To use in addons

lib = LibStub("LibColors-1.0")

 

API

num2hex
convert a number between 0 and 1 into a hex code between 00 and ff

 string = lib:num2hex( number ) 
colorTable2HexCode
converts numeric or associative color tables into a 8 character long hex color code.

assoc_table = { r = 0.8, g = 0.8, b = 0.1, a = 1 }
numeric_table = {
	0.8, -- red
	0.8, -- green
	0.8, -- blue
	1 -- alpha
}
string = lib:colorTable2HexCode( table )
any not defined or nil table entry will be ignored.
an empty table returns the hex code for the color white.
hexCode2ColorTable
converts a hex code into a color table

 table = lib:hexCode2ColorTable( string ) 
coloset
add a single color code

 lib:colorset( string, string or table ) 
or add a list of color codes

table = { ["color name"] = color string or color table }
lib:colorset( table ) 
color
create a colored string like |c<color><string>|r

 string = lib:color( color, string )
as first parameter you can use colors names, color tables or keywords
currently implemented keyword for color are “playerclass”
as second parameter you can use normal text or a keyword
currently implemented keyword for second parameter are “colortable”
that returns the requested color as colortable.
getNames
the parameter are optional and used to return matching color names.

 table = lib:getNames( [string] )

Available colors

Direct integrated
colors = {
	-- basic colors
	yellow = "ffff00",
	orange = "ff8000",
	red    = "ff0000",
	violet = "ff00ff",
	blue   = "0000ff",
	cyan   = "00ffff",
	green  = "00ff00",
	black  = "000000",
	gray   = "808080",
	white  = "ffffff",
	-- wow money colors
	money_gold   = "ffd700",
	money_silver = "eeeeef",
	money_copper = "f0a55f",
}
Color sets in extra files
You can find 3 files named colors_<name>.lua in the directory and in LibColors-1.0.xml the lines to use it.
The sources for the color sets are on top of the files.

Licence

To the hell with all licenses, the hole money, all weapons and other bad things… 😛

Hizuro’s other projects

 • https://www.curseforge.com/members/hizuro_de/projects

Comments

Add a comment