Color-code itemstacks with nbt data

This commit is contained in:
Gabriel Tofvesson 2024-10-09 04:27:07 +02:00
parent 3f3dd111c1
commit 32361db152

View File

@ -158,7 +158,9 @@ local function itemList(groups, wBudget, hBudget, savedState, onClick, setPage,
text = text:sub(1,textBudget)
end
local textLabel = Text:new{ text = text, bgColor = bgColors[i % 2] }
local nbtColor = group:getNBT() and colors.cyan or nil
local textLabel = Text:new{ text = text, bgColor = bgColors[i % 2], fgColor = nbtColor }
local countLabel = Text:new{ text = count, bgColor = bgColors[i % 2] }
local paddedText = Padding:new{
left = 0,
@ -290,7 +292,7 @@ local PAGES = {
state:setPage("MAIN")
return NOOP
end
local hello = Text:new{
local title = Text:new{
text = "Detail: "..group:getSimpleName(),
parent = state.monitor,
onClick = function(e, x, y, s)
@ -298,7 +300,15 @@ local PAGES = {
end
}
return renderDefault(state, hello)
local paddedTitle = Padding:new{
top = 1,
left = 1,
right = 1,
bottom = 1,
element = title
}
return renderDefault(state, paddedTitle)
end,
REQUEST = function(state, newPage)