mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-25 16:53:46 +01:00
Fix colorspec:to_string
This commit is contained in:
parent
44a98a7d41
commit
9d50e504fd
@ -255,9 +255,9 @@ end
|
||||
--> hex string, omits alpha if possible (if opaque)
|
||||
function colorspec:to_string()
|
||||
if self.a == 255 then
|
||||
return ("%02X02X02X"):format(self.r, self.g, self.b)
|
||||
return ("%02X%02X%02X"):format(self.r, self.g, self.b)
|
||||
end
|
||||
return ("%02X02X02X02X"):format(self.r, self.g, self.b, self.a)
|
||||
return ("%02X%02X%02X%02X"):format(self.r, self.g, self.b, self.a)
|
||||
end
|
||||
|
||||
function colorspec:to_number()
|
||||
|
1
test.lua
1
test.lua
@ -267,6 +267,7 @@ test_from_string("aliceblue#42", 0xf0f8ff42)
|
||||
test_from_string("#333", 0x333333FF)
|
||||
test_from_string("#694269", 0x694269FF)
|
||||
test_from_string("#11223344", 0x11223344)
|
||||
assert(colorspec.from_string"#694269":to_string() == "694269")
|
||||
|
||||
local function test_logfile(reference_strings)
|
||||
local logfile = persistence.lua_log_file.new(mod.get_resource"logfile.test.lua", {}, reference_strings)
|
||||
|
Loading…
Reference in New Issue
Block a user