starlit  Diff

Differences From Artifact [765cced2b5]:

To Artifact [77b0e87fc7]:


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
				self.curs.y = math.max(h, self.curs.y + self.curs.maxh)
				self.curs.maxh = 0
			end;
			attach = function(self, elt, x, y, w, h, ...)
				local content = ''
				if self.width - self.curs.x < w then self:nl() end
				for _, v in pairs{...} do
					content = content .. ';' .. minetest.formspec_escape(tostring(v))
				end
				self.src = self.src .. string.format('%s[%f,%f;%f,%f%s]', elt, x,y, w,h, content)
				if h > self.curs.maxh then self.curs.maxh = h end
			end;
			add = function(self, elt, w, h, ...)
				local ax, ay = self.curs.x, self.curs.y
				self:attach(elt, ax,ay, w,h, ...)
................................................................................
		-- takes a configuration table mapping affinities to colors.
		-- 'neutral' is the only required affinity
		return function(a)
			local color = a.color and a.color:readable(0.65, 1.0)
			if color == nil then color = l.color(.5,.5,.5) 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(0.6, 1.0)
................................................................................

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

					if prop.title then
						str = str .. c:brighten(1.2):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;
	end;
}







|







 







|







 







|










10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
				self.curs.y = math.max(h, self.curs.y + self.curs.maxh)
				self.curs.maxh = 0
			end;
			attach = function(self, elt, x, y, w, h, ...)
				local content = ''
				if self.width - self.curs.x < w then self:nl() end
				for _, v in pairs{...} do
					content = content .. ';' .. core.formspec_escape(tostring(v))
				end
				self.src = self.src .. string.format('%s[%f,%f;%f,%f%s]', elt, x,y, w,h, content)
				if h > self.curs.maxh then self.curs.maxh = h end
			end;
			add = function(self, elt, w, h, ...)
				local ax, ay = self.curs.x, self.curs.y
				self:attach(elt, ax,ay, w,h, ...)
................................................................................
		-- takes a configuration table mapping affinities to colors.
		-- 'neutral' is the only required affinity
		return function(a)
			local color = a.color and a.color:readable(0.65, 1.0)
			if color == nil then color = l.color(.5,.5,.5) end
			local str = a.title
			if a.desc then
				str = str .. '\n' .. color:fmt(core.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(0.6, 1.0)
................................................................................

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

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

					local lines = core.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;
	end;
}