sorcery  Artifact [787cef01b1]

Artifact 787cef01b183e352a8a95a21edebfad83af83771a51eedddd545b365476b81f9:


local l = sorcery.lib
local dui = sorcery.data.ui

return {
	tooltip = function(a)
		local color = a.color and a.color:readable()
		if color == nil then color = l.color(136,158,177) end
		local str = a.title
		if a.desc then
			str = str .. '\n' .. color:fmt(minetest.wrap_text(a.desc,60))
		end
		if a.props then
			-- str = str .. '\n'
			for _,prop in pairs(a.props) do
				local c
				if prop.color and l.color.id(prop.color) then
					c = prop.color:readable()
				elseif dui.colors[prop.affinity] then
					c = l.color(dui.colors[prop.affinity])
				else
					c = l.color(dui.colors.neutral)
				end

				str = str .. '\n ' .. c:fmt('* ')

				if prop.title then
					str = str .. c:brighten(1.3):fmt(prop.title) .. ': '
				end

				local lines = minetest.wrap_text(prop.desc, 55, true)
				str = str .. c:fmt(lines[1])
				for i=2,#lines do
					str = str .. '\n' .. string.rep(' ',5) .. c:fmt(lines[i])
				end
			end
		end
		return color:darken(0.8):bg(str)
	end;
}