mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
Removed lume.rgba
(superseded by lume.color
)
This commit is contained in:
parent
b539dc74c7
commit
758067dd33
@ -442,14 +442,6 @@ lume.color("#00ffff", 256) -- Returns 0, 256, 256, 256
|
|||||||
lume.color("rgb(255, 0, 0)", 256) -- Returns 256, 0, 0, 256
|
lume.color("rgb(255, 0, 0)", 256) -- Returns 256, 0, 0, 256
|
||||||
```
|
```
|
||||||
|
|
||||||
#### lume.rgba(color)
|
|
||||||
Takes the 32bit integer `color` argument and returns 4 numbers, one for each
|
|
||||||
channel, with a range of 0 - 255. The returned values can be used as the
|
|
||||||
arguments to [LÖVE](http://love2d.org)'s setColor() function.
|
|
||||||
```lua
|
|
||||||
lume.rgba(0xFF304050) -- Returns 48, 64, 80, 255
|
|
||||||
```
|
|
||||||
|
|
||||||
#### lume.chain(value)
|
#### lume.chain(value)
|
||||||
Returns a wrapped object which allows chaining of lume functions. The function
|
Returns a wrapped object which allows chaining of lume functions. The function
|
||||||
result() should be called at the end of the chain to return the resulting
|
result() should be called at the end of the chain to return the resulting
|
||||||
|
9
lume.lua
9
lume.lua
@ -739,15 +739,6 @@ function lume.color(str, mul)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function lume.rgba(color)
|
|
||||||
local a = math_floor((color / 16777216) % 256)
|
|
||||||
local r = math_floor((color / 65536) % 256)
|
|
||||||
local g = math_floor((color / 256) % 256)
|
|
||||||
local b = math_floor((color) % 256)
|
|
||||||
return r, g, b, a
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local chain_mt = {}
|
local chain_mt = {}
|
||||||
chain_mt.__index = lume.map(lume.filter(lume, iscallable, true),
|
chain_mt.__index = lume.map(lume.filter(lume, iscallable, true),
|
||||||
function(fn)
|
function(fn)
|
||||||
|
@ -607,15 +607,6 @@ tests["lume.color"] = function()
|
|||||||
tester.test.error(lume.color, "rgba(1, 1, 1, 1")
|
tester.test.error(lume.color, "rgba(1, 1, 1, 1")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- lume.rgba
|
|
||||||
tests["lume.rgba"] = function()
|
|
||||||
local r, g, b, a = lume.rgba(0x12345678)
|
|
||||||
testeq( a, 0x12 )
|
|
||||||
testeq( r, 0x34 )
|
|
||||||
testeq( g, 0x56 )
|
|
||||||
testeq( b, 0x78 )
|
|
||||||
end
|
|
||||||
|
|
||||||
-- lume.chain
|
-- lume.chain
|
||||||
tests["lume.chain"] = function()
|
tests["lume.chain"] = function()
|
||||||
local t = lume.chain({1, 2}):map(function(x) return x * 2 end):result()
|
local t = lume.chain({1, 2}):map(function(x) return x * 2 end):result()
|
||||||
|
Loading…
Reference in New Issue
Block a user