Add new theme code

Themes are now in separate folders except for Freedom, which is the default.
This commit is contained in:
v-rob 2017-12-06 16:21:03 -08:00 committed by GitHub
parent c0f1f66047
commit eb9f7aeee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 21 deletions

View File

@ -1,31 +1,28 @@
laptop.themes = {
blue = {
launcher_bg = "laptop_theme_blue_launcher_bg.png",
app_bg = "laptop_theme_blue_app_bg.png",
major_button = "laptop_theme_blue_major_button.png",
minor_button = "laptop_theme_minor_button.png",
back_button = "laptop_theme_blue_back_button.png",
exit_button = "laptop_theme_blue_exit_button.png",
},
red = {
launcher_bg = "laptop_theme_red_launcher_bg.png",
app_bg = "laptop_theme_red_app_bg.png",
major_button = "laptop_theme_red_major_button.png",
minor_button = "laptop_theme_minor_button.png",
back_button = "laptop_theme_red_back_button.png",
exit_button = "laptop_theme_red_exit_button.png",
},
freedom = {
Freedom = {
launcher_bg = "laptop_theme_freedom_launcher_bg.png",
},
cubic = {
launcher_bg = "laptop_theme_cubic_launcher_bg.png",
app_bg = "laptop_theme_freedom_app_bg.png",
major_button = "laptop_theme_freedom_major_button.png",
minor_button = "laptop_theme_minor_button.png",
back_button = "laptop_theme_freedom_back_button.png",
exit_button = "laptop_theme_freedom_exit_button.png",
app_button = "laptop_theme_freedom_app_button.png",
},
}
laptop.themes.default = laptop.themes.blue -- default can be an complete theme only
laptop.themes.default = laptop.themes.Freedom -- default can be an complete theme only
function laptop.register_theme(name, def)
laptop.themes[name] = def
end
-- load all themes
local theme_path = minetest.get_modpath('laptop')..'/themes/'
local theme_list = minetest.get_dir_list(theme_path, false)
for _, file in ipairs(theme_list) do
if file:sub(-10) == '_theme.lua' then
dofile(theme_path..file)
end
end

9
themes/3lue_theme.lua Normal file
View File

@ -0,0 +1,9 @@
laptop.register_theme("3lue", {
launcher_bg = "laptop_theme_3lue_launcher_bg.png",
app_bg = "laptop_theme_3lue_app_bg.png",
major_button = "laptop_theme_3lue_major_button.png",
minor_button = "laptop_theme_minor_button.png",
back_button = "laptop_theme_3lue_back_button.png",
exit_button = "laptop_theme_3lue_exit_button.png",
app_button = "laptop_theme_3lue_app_button.png",
})

9
themes/basic_theme.lua Normal file
View File

@ -0,0 +1,9 @@
laptop.register_theme("Basic", {
launcher_bg = "laptop_theme_basic_launcher_bg.png",
app_bg = "laptop_theme_basic_app_bg.png",
major_button = "laptop_theme_basic_button.png",
minor_button = "laptop_theme_basic_button.png",
back_button = "blank.png",
exit_button = "blank.png",
app_button = "blank.png",
})

9
themes/cubic_theme.lua Normal file
View File

@ -0,0 +1,9 @@
laptop.register_theme("Cubic", {
launcher_bg = "laptop_theme_cubic_launcher_bg.png",
app_bg = "laptop_theme_cubic_app_bg.png",
major_button = "laptop_theme_cubic_major_button.png",
minor_button = "laptop_theme_minor_button.png",
back_button = "laptop_theme_cubic_back_button.png",
exit_button = "laptop_theme_cubic_exit_button.png",
app_button = "laptop_theme_cubic_app_button.png",
})

9
themes/magma_theme.lua Normal file
View File

@ -0,0 +1,9 @@
laptop.register_theme("Magma", {
launcher_bg = "laptop_theme_magma_launcher_bg.png",
app_bg = "laptop_theme_magma_app_bg.png",
major_button = "laptop_theme_magma_major_button.png",
minor_button = "laptop_theme_minor_button.png",
back_button = "laptop_theme_magma_back_button.png",
exit_button = "laptop_theme_magma_exit_button.png",
app_button = "laptop_theme_magma_app_button.png",
})

9
themes/r3d_theme.lua Normal file
View File

@ -0,0 +1,9 @@
laptop.register_theme("R3D", {
launcher_bg = "laptop_theme_r3d_launcher_bg.png",
app_bg = "laptop_theme_r3d_app_bg.png",
major_button = "laptop_theme_r3d_major_button.png",
minor_button = "laptop_theme_minor_button.png",
back_button = "laptop_theme_r3d_back_button.png",
exit_button = "laptop_theme_r3d_exit_button.png",
app_button = "laptop_theme_r3d_app_button.png",
})