diff options
author | Wuzzy <almikes@aol.com> | 2016-12-23 17:55:20 +0100 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-12-23 17:55:20 +0100 |
commit | 825cc52f2956ca9c3c38397d8dfafc9e56fafde0 (patch) | |
tree | 4c3fed82d903b5ab5685070804dd492b3291cec2 /init.lua | |
parent | 473972112240cdf20dcbc1d5e05d2c3eff1a1a7a (diff) |
Use core.colorize for category stats
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -39,6 +39,10 @@ doc.FORMSPEC.ENTRY_HEIGHT = doc.FORMSPEC.ENTRY_END_Y - doc.FORMSPEC.ENTRY_START_ -- Internal helper variables local DOC_INTRO = S("This is the help.") +local COLOR_NOT_VIEWED = "#00FFFF" -- cyan +local COLOR_VIEWED = "#FFFFFF" -- white +local COLOR_HIDDEN = "#999999" -- gray + local CATEGORYFIELDSIZE = { WIDTH = math.ceil(doc.FORMSPEC.WIDTH / 4), HEIGHT = math.floor(doc.FORMSPEC.HEIGHT-1), @@ -800,8 +804,7 @@ function doc.generate_entry_list(cid, playername) table.insert(doc.data.players[playername].entry_ids, eid) doc.data.players[playername].catsel_list[eid] = counter + 1 -- Colorize entries based on viewed status - -- Not viewed: Cyan - local viewedprefix = "#00FFFF" + local viewedprefix = COLOR_NOT_VIEWED local name = edata.name if name == nil or name == "" then name = S("Nameless entry (@1)", eid) @@ -811,8 +814,7 @@ function doc.generate_entry_list(cid, playername) viewedprefix = "#FF0000" end elseif doc.entry_viewed(playername, cid, eid) then - -- Viewed: White - viewedprefix = "#FFFFFF" + viewedprefix = COLOR_VIEWED end entry_textlist = entry_textlist .. viewedprefix .. minetest.formspec_escape(name) .. "," counter = counter + 1 @@ -916,10 +918,10 @@ function doc.formspec_category(id, playername) local new = total - viewed - hidden -- TODO/FIXME: Check if number of hidden/viewed entries is always correct if viewed < total then - formstring = formstring .. minetest.formspec_escape(S("New entries: @1", new)) + formstring = formstring .. core.colorize(COLOR_NOT_VIEWED, minetest.formspec_escape(S("New entries: @1", new))) if hidden > 0 then formstring = formstring .. "\n" - formstring = formstring .. minetest.formspec_escape(S("Hidden entries: @1", hidden)).."]" + formstring = formstring .. core.colorize(COLOR_HIDDEN, minetest.formspec_escape(S("Hidden entries: @1", hidden))).."]" else formstring = formstring .. "]" end |