img



img

LibColors-1.0


By: hizuro_de
Addon | img 17,494




Description

___________________________________________________________________________________________________________________________

Short description

This library allows you to color strings easily by using hex code, color tables and other information.

Types supported

Hexadecimal code of 8 or 6 characters. [ ] Like 9E342C. Alpha is optional.

{color table in two variants: Two color tables in two variations: , , , or { ["r"] = , ["g"] = , ["b"] = , ["a"] = }

Class names support English and localized names for non-english clients

ITEM_QUALITY_COLORS as quality[number] and lower string version of ITEM_QUALITY[number]_DESC

Or keywords

The playerclass color will change to the existing players class.

Second parameter cannot be a color string

Not set second parameter returns color code in hex

The string "colortable", as second parameter, returns the color requested as a color table

Add-ons

lib = LibStub("LibColors-1.0")

API

num2hex

Convert a number from 0 to 1 into a Hex Code between 00-ff

String = lib :num2hex ( number)

colorTable2HexCode

Converts color tables that are numeric or associated into an 8-character long color code.

Assoc_table= r=0.8,g=0.8,b=0.1,a =1

numeric_table = {

Red 0.8

Green 0.8

Blue 0.8

Alpha 1

}

string = lib:colorTable2HexCode( table )

Any table entries that are not defined, or have a nil value will be ignored.

An empty table will return the hexcode for white.

hexCode2ColorTable

Converts a Hex Code into a Color Table

table = lib:hexCode2ColorTable( string )

Colset

Add a color code

Color Set (string, table or string)

Add a color code list

table = ["color name"] = color string or color table

lib:colorset( table )

Colors

c |r

string = lib:color( color, string )

You can also use color names, color tables and keywords as the first parameter.

The keyword used for the color is "playerclass".

As a second parameter, you can either use a normal text or keyword

The keyword currently used for the second parameter is "colorable".

This returns the color requested as a colortable.

GetNames

The parameter is optional. It can be used to find colors that match the color name.

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",
}

Extra files of color sets

There are 3 files called colors_ .lua file in the directory, and the lines in LibColors.xml to use.

On the top of each file, you will find the sources for color sets.




About Project

Created: March 2nd 2024

Updated: March 2nd 2024

Project ID: 26750

License: All Rights Reserved

__________________________________________

Game Versions:

1.01.03

1.01.03

1.01.03

1.01.03

1.01.03

__________________________________________

Flavors:

WoW Retail

__________________________________________

Categories

Companions

Battle

__________________________________________

Main File

hizuro_de_LibColors-1.0.zip
  • Release
  • March 2nd 2024

    __________________________________________

    Recent File

    hizuro_de_LibColors-1.0.zip
  • Release
  • March 2nd 2024

    __________________________________________

    Members

    img
    hizuro_de
    Owner

    __________________________________________

    Report