MapGen: add load fixColor to mapgen async
This commit is contained in:
@@ -3,23 +3,5 @@ Smc = {}
|
||||
local modInfo = Mod.getInfo('smc__system__helper_lib')
|
||||
local require = modInfo.require
|
||||
|
||||
---Converts a colorstring into a single representation so that similar colors can match.
|
||||
---@param color ColorString
|
||||
---@return ColorString
|
||||
function Smc.fixColorString(color)
|
||||
local colorTable = core.colorspec_to_table(color)
|
||||
|
||||
if colorTable == nil then
|
||||
return ''
|
||||
end
|
||||
|
||||
local colorString = core.colorspec_to_colorstring(colorTable)
|
||||
|
||||
if colorString == nil then
|
||||
return ''
|
||||
end
|
||||
|
||||
return colorString
|
||||
end
|
||||
|
||||
require('Lib.globalStep')
|
||||
require('Lib.color')
|
||||
|
||||
18
mods/SYSTEM/HelperLib/src/Lib/color.lua
Normal file
18
mods/SYSTEM/HelperLib/src/Lib/color.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
---Converts a colorstring into a single representation so that similar colors can match.
|
||||
---@param color ColorString
|
||||
---@return ColorString
|
||||
function Smc.fixColorString(color)
|
||||
local colorTable = core.colorspec_to_table(color)
|
||||
|
||||
if colorTable == nil then
|
||||
return ''
|
||||
end
|
||||
|
||||
local colorString = core.colorspec_to_colorstring(colorTable)
|
||||
|
||||
if colorString == nil then
|
||||
return ''
|
||||
end
|
||||
|
||||
return colorString
|
||||
end
|
||||
Reference in New Issue
Block a user