1-- Copyright © 2008-2021 Pioneer Developers. See AUTHORS.txt for details 2-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt 3 4local ui = require 'pigui' 5local debugView = require 'pigui.views.debug' 6 7local colors = ui.theme.colors 8local styleColors = ui.theme.styleColors 9 10local sortedColors, sortedStyleColors = {}, {} 11for name in pairs(colors) do table.insert(sortedColors, name) end 12for name in pairs(styleColors) do table.insert(sortedStyleColors, name) end 13table.sort(sortedColors) 14table.sort(sortedStyleColors) 15 16debugView.registerTab('debug-theme-colors', function() 17 if not ui.beginTabItem("Theme Colors") then return end 18 ui.text("Palette Colors") 19 ui.separator() 20 for _, name in ipairs(sortedStyleColors) do 21 local changed, ncolor = ui.colorEdit(name, styleColors[name], false) 22 -- if we're changing semantic colors, we want to update all uses of the color object 23 if changed then styleColors[name](ncolor.r, ncolor.g, ncolor.b) end 24 end 25 26 ui.newLine() 27 ui.text("Semantic Colors") 28 ui.separator() 29 for _, name in ipairs(sortedColors) do 30 local changed, color = ui.colorEdit(name, colors[name], true) 31 if changed then colors[name] = color end 32 end 33 ui.endTabItem() 34end) 35