mirror of
https://github.com/airstruck/luigi.git
synced 2025-12-19 02:16:43 +00:00
add dark theme
This commit is contained in:
@@ -19,7 +19,7 @@ end)
|
||||
|
||||
layout:onMove(function (event)
|
||||
local w = event.target
|
||||
layout.statusbar.text = (tostring(w.type)) ..
|
||||
layout.statusbar.text = (tostring(w.type)) .. ' ' ..
|
||||
(w.id or '(unnamed)') .. ' ' ..
|
||||
w:getX() .. ', ' .. w:getY() .. ' | ' ..
|
||||
w:getWidth() .. 'x' .. w:getHeight()
|
||||
@@ -30,28 +30,10 @@ layout.newButton:onMove(function (event)
|
||||
return false
|
||||
end)
|
||||
|
||||
local foo = Layout { float = true, height = 100,
|
||||
text = 'hello', align = 'center middle', background = {255,0,0}
|
||||
}
|
||||
|
||||
foo:onReshape(function (event)
|
||||
foo:hide()
|
||||
end)
|
||||
|
||||
layout.newButton:onPress(function (event)
|
||||
print('creating a new thing!')
|
||||
end)
|
||||
|
||||
layout.aButton:onPress(function (event)
|
||||
layout.aButton.font = nil
|
||||
layout.aButton.width = layout.aButton.width + 10
|
||||
local w = layout.aButton:getWidth()
|
||||
foo.root.width = w * 2
|
||||
foo.root.left = layout.aButton:getX() - w
|
||||
foo.root.top = layout.aButton:getY() - foo.root.height
|
||||
foo:show()
|
||||
end)
|
||||
|
||||
layout.mainCanvas.font = 'font/DejaVuSansMono.ttf'
|
||||
|
||||
layout.mainCanvas.text = [[
|
||||
@@ -78,12 +60,6 @@ layout.mainCanvas.align = 'top'
|
||||
|
||||
layout.mainCanvas.wrap = true
|
||||
|
||||
local Backend = require 'luigi.backend'
|
||||
|
||||
layout.menuQuit:onPress(function (event) Backend.quit() end)
|
||||
|
||||
layout.themeLight:onPress(function (event) Backend.quit() end)
|
||||
|
||||
-- license dialog
|
||||
|
||||
local licenseDialog = Layout(require 'layout.license')
|
||||
@@ -98,9 +74,43 @@ layout.license:onPress(function()
|
||||
licenseDialog:show()
|
||||
end)
|
||||
|
||||
-- about dialog
|
||||
|
||||
local aboutDialog = Layout(require 'layout.about')
|
||||
|
||||
aboutDialog:setStyle(style)
|
||||
|
||||
aboutDialog.closeButton:onPress(function()
|
||||
aboutDialog:hide()
|
||||
end)
|
||||
|
||||
layout.about:onPress(function()
|
||||
aboutDialog:show()
|
||||
end)
|
||||
|
||||
-- menu/view/theme
|
||||
|
||||
layout.themeLight:onPress(function (event)
|
||||
local light = require 'luigi.theme.light'
|
||||
layout:setTheme(light)
|
||||
licenseDialog:setTheme(light)
|
||||
aboutDialog:setTheme(light)
|
||||
end)
|
||||
|
||||
layout.themeDark:onPress(function (event)
|
||||
local dark = require 'luigi.theme.dark'
|
||||
layout:setTheme(dark)
|
||||
licenseDialog:setTheme(dark)
|
||||
aboutDialog:setTheme(dark)
|
||||
end)
|
||||
|
||||
-- menu/file/quit
|
||||
-- uses Backend for compat with love or ffisdl
|
||||
local Backend = require 'luigi.backend'
|
||||
layout.menuQuit:onPress(function (event) Backend.quit() end)
|
||||
|
||||
-- show the main layout
|
||||
|
||||
layout:show()
|
||||
|
||||
Backend.run() -- only needed when using ffisdl backend
|
||||
-- only needed when using ffisdl backend
|
||||
Backend.run()
|
||||
|
||||
Reference in New Issue
Block a user