Merge pull request #53 from bell07/pr_contrast_background

Mail adjustments for #51
This commit is contained in:
Gerold55 2017-12-13 14:52:00 -05:00 committed by GitHub
commit 0bcae1e292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 9 deletions

3
API.md
View File

@ -68,11 +68,12 @@ same as register_app, but the view flag is set. app_name and app_icon not necess
Definitiontable: Definitiontable:
- `launcher_bg` Launcher background image - `launcher_bg` Launcher background image
- `app_bg` Apps background image - `app_bg` Apps background image
- `contrast_bg` dark background to place under white text elements that does not support textcolor
- `textcolor` Default text color for buttons and labels. For buttons the major_textcolor and minor_textcolor supported
- `back_button` Back Button image - `back_button` Back Button image
- `exit_button` Exit button image - `exit_button` Exit button image
- `major_button` Major (highlighted) button image - `major_button` Major (highlighted) button image
- `minor_button` Minor button image - `minor_button` Minor button image
- `textcolor` Default text color for buttons and labels. For buttons the major_textcolor and minor_textcolor supported
## Theme methods ## Theme methods
`function laptop.get_theme(theme_name)` `function laptop.get_theme(theme_name)`

View File

@ -79,9 +79,9 @@ laptop.register_app("mail", {
-- toggle inbox/sentbox -- toggle inbox/sentbox
if account.selected_box == "inbox" then if account.selected_box == "inbox" then
formspec = formspec .. mtos.theme:get_button('0,9;1.5,1', 'minor', 'switch_sentbox', 'Sentbox', 'Show sent messages') formspec = formspec .. "image_button[0,8.8;1.5,1.5;"..mtos.theme.minor_button.."^laptop_mail_sentbox.png;switch_sentbox;]tooltip[switch_sentbox;Show sent messages]"
else else
formspec = formspec .. mtos.theme:get_button('0,9;1.5,1', 'minor', 'switch_inbox', 'Inbox', 'Show received messages') formspec = formspec .. "image_button[0,8.8;1.5,1.5;"..mtos.theme.minor_button.."^laptop_mail_received.png;switch_inbox;]tooltip[switch_inbox;Show received messages]"
end end
formspec = formspec .. "image_button[1.7,9;1,1;"..mtos.theme.minor_button.."^laptop_email_new.png;new;]tooltip[new;New message]" formspec = formspec .. "image_button[1.7,9;1,1;"..mtos.theme.minor_button.."^laptop_email_new.png;new;]tooltip[new;New message]"
@ -108,7 +108,7 @@ laptop.register_app("mail", {
end end
formspec = formspec .. mtos.theme:get_label('8,1', "Subject: "..(account.selectedmessage.subject or "")).. formspec = formspec .. mtos.theme:get_label('8,1', "Subject: "..(account.selectedmessage.subject or ""))..
"background[8,1.55;6.92,7.3;gui_formbg.png]".. "background[8,1.55;6.92,7.3;"..mtos.theme.contrast_bg.."]"..
"textarea[8.25,1.5;7,8.35;body;;"..(minetest.formspec_escape(account.selectedmessage.body) or "").."]" "textarea[8.25,1.5;7,8.35;body;;"..(minetest.formspec_escape(account.selectedmessage.body) or "").."]"
end end
return formspec return formspec
@ -211,9 +211,9 @@ laptop.register_view("mail:compose", {
account.newmessage = account.newmessage or {} account.newmessage = account.newmessage or {}
local message = account.newmessage local message = account.newmessage
local formspec = "background[-0.1,0.4;4.2,2.4;gui_formbg.png]".. local formspec = "background[-0.1,0.4;4.2,2.4;"..mtos.theme.contrast_bg.."]"..
"field[0.25,1;4,1;receiver;To:;%s]field[0.25,2;4,1;subject;Subject:;%s]".. "field[0.25,1;4,1;receiver;To:;%s]field[0.25,2;4,1;subject;Subject:;%s]"..
"background[0,3.05;7.95,3.44;gui_formbg.png]".. "background[0,3.05;7.95,3.44;"..mtos.theme.contrast_bg.."]"..
"textarea[0.25,3;8,4;body;;%s]".. "textarea[0.25,3;8,4;body;;%s]"..
mtos.theme:get_button("0,8;2,1", "major", "send", "Send message") mtos.theme:get_button("0,8;2,1", "major", "send", "Send message")
formspec = string.format(formspec,minetest.formspec_escape(message.receiver or ""),minetest.formspec_escape(message.subject or ""),minetest.formspec_escape(message.body or "")) formspec = string.format(formspec,minetest.formspec_escape(message.receiver or ""),minetest.formspec_escape(message.subject or ""),minetest.formspec_escape(message.body or ""))

View File

@ -2,14 +2,14 @@ laptop.register_app("stickynote", {
app_name = "Notepad", app_name = "Notepad",
app_icon = "laptop_notes_pad.png", app_icon = "laptop_notes_pad.png",
app_info = "Write notes in a text document.", app_info = "Write notes in a text document.",
formspec_func = function(app, os) formspec_func = function(app, mtos)
local data = app:get_storage_ref() local data = app:get_storage_ref()
data.text = data.text or "" data.text = data.text or ""
return "background[0,0.35;15.2,9.2;gui_formbg.png]".. return "background[0,0.35;15.2,9.2;"..mtos.theme.contrast_bg.."]"..
"textarea[0.35,0.35;15.08,10.5;text;;"..minetest.formspec_escape(data.text).."]" "textarea[0.35,0.35;15.08,10.5;text;;"..minetest.formspec_escape(data.text).."]"
end, end,
receive_fields_func = function(app, os, fields, sender) receive_fields_func = function(app, mtos, fields, sender)
if fields.text then if fields.text then
local data = app:get_storage_ref() local data = app:get_storage_ref()
data.text = fields.text data.text = fields.text

View File

Before

Width:  |  Height:  |  Size: 467 B

After

Width:  |  Height:  |  Size: 467 B

View File

@ -8,6 +8,7 @@ laptop.themes = {
exit_button = "laptop_theme_freedom_exit_button.png", exit_button = "laptop_theme_freedom_exit_button.png",
app_button = "laptop_theme_freedom_app_button.png", app_button = "laptop_theme_freedom_app_button.png",
textcolor = "#000000", textcolor = "#000000",
contrast_bg = "gui_formbg.png",
}, },
} }