WoW LibPrism-1.0 addon Dragonflight/Wrath of the Lich King Classic 2024
logo
wow addon LibPrism-1.0

LibPrism-1.0

Game Version: 8.2.5
Total Downloads: 2,805
Updated: Oct 31, 2019
Created: Nov 14, 2013
download LibPrism-1.0Download Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
v1.0.7 release 10.32 KB Oct 31, 2019 8.2.5 137 download LibPrism-1.0 v1.0.7 releaseDownload
v1.0.6-repackage release 8.73 KB Oct 20, 2019 8.2.5 24 download LibPrism-1.0 v1.0.6-repackage releaseDownload
v1.0.6a-classic release 8.84 KB Sep 30, 2019 1.13.2 892 download LibPrism-1.0 v1.0.6a-classic releaseDownload
v1.0.5 release 8.29 KB Jul 25, 2016 7.0.3 447 download LibPrism-1.0 v1.0.5 releaseDownload
v1.0.4 release 8.23 KB Jul 20, 2015 6.2.0 240 download LibPrism-1.0 v1.0.4 releaseDownload
v1.0.3 release 8.31 KB Nov 13, 2014 6.0.3 256 download LibPrism-1.0 v1.0.3 releaseDownload
v1.0.2 release 9.05 KB Dec 5, 2013 5.4.1 320 download LibPrism-1.0 v1.0.2 releaseDownload
v1.0.2b beta 7.95 KB Nov 24, 2013 5.4.1 50 download LibPrism-1.0 v1.0.2b betaDownload
f073fa7-classic alpha 9.64 KB Sep 12, 2019 1.13.2 24 download LibPrism-1.0 f073fa7-classic alphaDownload
541df9d-classic alpha 9.60 KB Sep 12, 2019 1.13.2 10 download LibPrism-1.0 541df9d-classic alphaDownload
bdd10a7-classic alpha 9.56 KB Sep 10, 2019 1.13.2 11 download LibPrism-1.0 bdd10a7-classic alphaDownload
v1.0.3-2-gd48294a alpha 8.23 KB Jul 19, 2016 7.0.3 26 download LibPrism-1.0 v1.0.3-2-gd48294a alphaDownload
v1.0.2-1-gff9b692 alpha 8.23 KB Oct 15, 2014 6.0.2 45 download LibPrism-1.0 v1.0.2-1-gff9b692 alphaDownload
v1.0.2b-5-g72085bc alpha 8.47 KB Nov 30, 2013 5.4.1 21 download LibPrism-1.0 v1.0.2b-5-g72085bc alphaDownload
v1.0.2b-4-gf37b2a2 alpha 8.50 KB Nov 27, 2013 5.4.1 18 download LibPrism-1.0 v1.0.2b-4-gf37b2a2 alphaDownload
v1.0.2b-3-g1032273 alpha 8.02 KB Nov 25, 2013 5.4.1 16 download LibPrism-1.0 v1.0.2b-3-g1032273 alphaDownload
v1.0.2b-2-g8d59d77 alpha 7.99 KB Nov 25, 2013 5.4.1 17 download LibPrism-1.0 v1.0.2b-2-g8d59d77 alphaDownload
v1.0.2a-9-g8ff7ba8 alpha 7.45 KB Nov 21, 2013 5.4.1 17 download LibPrism-1.0 v1.0.2a-9-g8ff7ba8 alphaDownload
v1.0.2a-8-gf096848 alpha 7.38 KB Nov 21, 2013 5.4.1 15 download LibPrism-1.0 v1.0.2a-8-gf096848 alphaDownload
v1.0.2a-7-ga8812b0 alpha 7.29 KB Nov 21, 2013 5.4.1 31 download LibPrism-1.0 v1.0.2a-7-ga8812b0 alphaDownload
v1.0.2a-6-g7ec974d alpha 7.25 KB Nov 20, 2013 5.4.1 23 download LibPrism-1.0 v1.0.2a-6-g7ec974d alphaDownload
v1.0.2a-4-g328bf56 alpha 7.18 KB Nov 20, 2013 5.4.1 18 download LibPrism-1.0 v1.0.2a-4-g328bf56 alphaDownload
v1.0.2a-3-g0d71a29 alpha 7.06 KB Nov 20, 2013 5.4.1 21 download LibPrism-1.0 v1.0.2a-3-g0d71a29 alphaDownload
v1.0.2a-2-gf521698 alpha 7.01 KB Nov 20, 2013 5.4.1 19 download LibPrism-1.0 v1.0.2a-2-gf521698 alphaDownload
v1.0.2a alpha 7.19 KB Nov 19, 2013 5.4.1 24 download LibPrism-1.0 v1.0.2a alphaDownload
r20131114184725 alpha 6.93 KB Nov 14, 2013 5.4.1 15 download LibPrism-1.0 r20131114184725 alphaDownload
r20131114165252 alpha 6.87 KB Nov 14, 2013 5.4.1 25 download LibPrism-1.0 r20131114165252 alphaDownload
r20131114015448 alpha 6.67 KB Nov 14, 2013 5.4.1 43 download LibPrism-1.0 r20131114015448 alphaDownload

Description

Share this:

A library intended to supply color manipulation tools.

 

Lazily defining F as the set of all values the 'number' type can have.

 

Assuming Prism = LibStub("LibPrism-1.0"):

 

Prism:Gradient(type, rMin, rMax, gMin, gMax, bMin, bMax, x)

Call with 2*rgb values representing the colors at x = 0 and x = 1 respectively, alongside the x coordinate you wish to get the value for and the type of gradient to use.

Parameters

type
Which gradient type to use. Currently supports HSV and RGB. More may be added at a later date.
rMin
The red color value at your starting point, {rMin ∈ F: 0 ≤ rMin ≤ 1}
rMax
The red color value at your ending point, {rMax ∈ F: 0 ≤ rMax ≤ 1}
gMin
The green color value at your starting point, {gMin∈ F: 0 ≤ gMin ≤ 1}
gMax
The green color value at your ending point, {gMax ∈ F: 0 ≤ gMax ≤ 1}
bMin
The blue color value at your starting point, {bMin ∈ F: 0 ≤ bMin ≤ 1}
bMax
The blue color value at your ending point, {bMax ∈ F: 0 ≤ bMax ≤ 1}
x
The x coordinate, or in other words a percentage describing how far the point the desired color is from the two end points, {x ∈ F: 0 ≤ x ≤ 1} is expected, but if x < 0 it will default to 0, and if x > 1 it will default to 1. For convenience, 0/0 will be defined as 0 for the purposes of this function.

Return values

[1]
Hexadecimal string, [00,ff][00,ff][00,ff]
[2]
The r value, where {r ∈ F: 0 ≤ r ≤ 1}
[3]
The g value, where {g ∈ F: 0 ≤ g ≤ 1}
[4]
The b value, where {b ∈ F: 0 ≤ b ≤ 1}

Usage

Prism:Gradient("hsv", 1, 0, 0, 1, 0, 0, .5) -- Would return the values "ffff00", 1, 1, 0
Prism:Gradient("hsv", 0, 1, 1, 1, 1, 0, .25) -- Would return the values "00ff7f", 0, 1, 0.5

Gradient types

HSV
The path between two points in a HSV cylinder. Which is to say, a three-dimensional approach to movement will be observed, as the function will move along the hue axis (circumference; periodical, with the period 360, as in not radians), the saturation axis (the radius) and the value (aka brightness) axis (height).
RGB
Linear progression along each of the RGB values, which makes for a seemingly less natural progression than the above method.

 

Prism:RGBtoHSV(r, g, b)

Converts a color from RGB to HSV.

Parameters

r
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
g
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
b
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}

Return values

[1]
The hue value, where {h ∈ F: 0 ≤ h ≤ 360}
[2]
The saturation value, where {s ∈ F: 0 ≤ s ≤ 1}
[3]
The brightness value, where {v ∈ F: 0 ≤ v ≤ 1}

Usage

Prism:RGBtoHSV(0, 1, 0) -- Would return the values 120, 1, 1

 

Prism:HSVtoRGB(h, s, v)

Converts a color from HSV to RGB.

Parameters

h
The hue value, where {h ∈ F: 0 ≤ h ≤ 360}
s
The saturation value, where {s ∈ F: 0 ≤ s ≤ 1}
v
The brightness value, where {v ∈ F: 0 ≤ v ≤ 1}

Return values

[1]
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
[2]
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
[3]
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}

Usage

Prism:RGBtoHSV(90, 1, 1) -- Would return the values 0.5, 1, 0

 

Prism:Saturate(r, g, b, m[, operation])

Increases the saturation of a color.

Parameters

r
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
g
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
b
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}
m
By how much the saturation should be increased, {m ∈ F: -1 ≤ m ≤ 1} for additive, m ∈ F for multiplicative.
operation
Which type of operation to perform. "add" for additive or "multi" for multiplicative. Defaults to additive.

Return values

[1]
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
[2]
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
[3]
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}

Usage

Prism:Saturate(.1, .2, .3, .4, "add") -- Would return the values 0, 0.15, 0.3
Prism:Saturate(.1, .2, .3, .4, "multi") -- Would return the values 0.02, 0.16, 0.3

 

Prism:Desaturate(r, g, b, m[, operation])

Decreases the saturation of a color.

Parameters

r
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
g
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
b
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}
m
By how much the saturation should be decreased, {m ∈ F: -1 ≤ m ≤ 1} for additive, m ∈ ℝ for multiplicative.
operation
Which type of operation to perform. "add" for additive or "multi" for multiplicative. Defaults to additive.

Return values

[1]
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
[2]
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
[3]
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}

Usage

Prism:Desaturate(.1, .2, .3, .4, "add") -- Would return the values 0.22, 0.26, 0.3
Prism:Desaturate(.1, .2, .3, .4, "multi") -- Would return the values 0.18, 0.24, 0.3

 

Prism:Lighten(r, g, b, m[, operation])

Brightens a color.

Parameters

r
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
g
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
b
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}
m
By how much the brightness should be increased, {m ∈ F: -1 ≤ m ≤ 1} for additive, m ∈ ℝ for multiplicative.
operation
Which type of operation to perform. "add" for additive or "multi" for multiplicative. Defaults to additive.

Return values

[1]
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
[2]
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
[3]
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}

Usage

Prism:Lighten(.1, .2, .3, .4, "add") -- Would return the values 0.233..., 0.466..., 0.7
Prism:Lighten(.1, .2, .3, .4, "multi") -- Would return the values 0.14, 0.28, 0.42

 

Prism:Darken(r, g, b, m[, operation])

Darkens a color.

Parameters

r
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
g
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
b
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}
m
By how much the brightness should be decreased, {m ∈ F: -1 ≤ m ≤ 1} for additive, m ∈ ℝ for multiplicative.
operation
Which type of operation to perform. "add" for additive or "multi" for multiplicative. Defaults to additive.

Return values

[1]
The red color value, {r ∈ F: 0 ≤ r ≤ 1}
[2]
The green color value, {g ∈ F: 0 ≤ g ≤ 1}
[3]
The blue color value, {b ∈ F: 0 ≤ b ≤ 1}

Usage

Prism:Darken(.1, .2, .3, .4, "add") -- Would return the values 0, 0, 0
Prism:Darken(.1, .2, .3, .4, "multi") -- Would return the values 0.06, 0.12, 0.18

 

 

Kept for backwards compatibility (as in, do not use, scheduled to be removed eventually):

  • Prism:GetAngleGradient(rMin, rMax, gMin, gMax, bMin, bMax, modifier)

Comments

Add a comment