Store colors and use a lighter selection color

This commit is contained in:
Athozus 2023-06-25 19:12:20 +02:00
parent f5198b9187
commit 95475c7c59
No known key found for this signature in database
GPG Key ID: B50895022E8484BF
12 changed files with 56 additions and 43 deletions

View File

@ -37,6 +37,19 @@ mail = {
trash_move_enable = {} trash_move_enable = {}
}, },
colors = {
header = "#999",
selected = "#72FF63",
important = "#FFD700",
additional = "#CCCCDD",
imp_sel = "#B9EB32",
add_sel = "#9FE6A0",
imp_add = "#E6D26F",
imp_add_sel = "#BFE16B",
highlighted = "#466432",
new = "#00F529"
},
message_drafts = {} message_drafts = {}
} }

View File

@ -17,7 +17,7 @@ minetest.register_on_joinplayer(function(player)
if unreadcount > 0 and mail.get_setting(name, "onjoin_notifications") then if unreadcount > 0 and mail.get_setting(name, "onjoin_notifications") then
minetest.chat_send_player(name, minetest.chat_send_player(name,
minetest.colorize("#00f529", "(" .. unreadcount .. ") " .. S("You have mail! Type /mail to read"))) minetest.colorize(mail.colors.new, "(" .. unreadcount .. ") " .. S("You have mail! Type /mail to read")))
end end
end, player:get_player_name()) end, player:get_player_name())
end) end)

View File

@ -21,27 +21,27 @@ function mail.show_about(name)
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[5,0.75;4.9,5.5;contributors;]] .. table[5,0.75;4.9,5.5;contributors;]] ..
[[#999,]] .. S("Contributors") .. [[,,]] .. mail.colors.header .. [[,]] .. S("Contributors") .. [[,,]] ..
[[#FFD700,Cheapie,Initial idea/project,]] .. mail.colors.important .. [[,Cheapie,Initial idea/project,]] ..
[[#FFF,Rubenwardy,Lua/UI improvements,]] .. [[,Rubenwardy,Lua/UI improvements,]] ..
[[#FFF,BuckarooBanzay,Clean-ups\, Refactoring,]] .. [[,BuckarooBanzay,Clean-ups\, Refactoring,]] ..
[[#FFF,Athozus,Boxes\, Maillists\, UI\, Settings,]] .. [[,Athozus,Boxes\, Maillists\, UI\, Settings,]] ..
[[#FFF,fluxionary,Minor fixups,]] .. [[,fluxionary,Minor fixups,]] ..
[[#FFF,SX,Various fixes\, UI,]] .. [[,SX,Various fixes\, UI,]] ..
[[#FFF,Toby1710,UX fixes,]] .. [[,Toby1710,UX fixes,]] ..
[[#FFF,Peter Nerlich,CC\, BCC,]] .. [[,Peter Nerlich,CC\, BCC,]] ..
[[#FFF,Niklp,German translation,]] .. [[,Niklp,German translation,]] ..
[[#FFF,Emojigit,Traditional Chinese trans.,]] .. [[,Emojigit,Traditional Chinese trans.,]] ..
[[#FFF,Dennis Jenkins,UX fixes,]] .. [[,Dennis Jenkins,UX fixes,]] ..
[[#FFF,Thomas Rudin,Maintenance,]] .. [[,Thomas Rudin,Maintenance,]] ..
[[#FFF,NatureFreshMilk,Maintenance,]] .. [[,NatureFreshMilk,Maintenance,]] ..
[[#FFF,imre84,UI fixes,]] .. [[,imre84,UI fixes,]] ..
[[#FFF,Chache,Spanish translation,]] .. [[,Chache,Spanish translation,]] ..
[[#FFF,APercy,Brazilian Portuguese trans.,]] .. [[,APercy,Brazilian Portuguese trans.,]] ..
[[#FFF,Nuno Filipe Povoa,mail_notif.ogg,]] .. [[,Nuno Filipe Povoa,mail_notif.ogg,]] ..
[[#FFF,TheTrueBeginner,Simplified Chinese trans.,]] .. [[,TheTrueBeginner,Simplified Chinese trans.,]] ..
[[#FFF,nyomi,Hungarian translation,]] .. [[,nyomi,Hungarian translation,]] ..
[[#FFF,whosit,UI fixes] [[,whosit,UI fixes]
]] .. mail.theme ]] .. mail.theme
minetest.show_formspec(name, FORMNAME, formspec) minetest.show_formspec(name, FORMNAME, formspec)

View File

@ -9,7 +9,7 @@ local contacts_formspec = "size[8,9;]" .. mail.theme .. [[
button[6,1.60;2,0.5;delete;]] .. S("Delete") .. [[] button[6,1.60;2,0.5;delete;]] .. S("Delete") .. [[]
button[6,8.25;2,0.5;back;]] .. S("Back") .. [[] button[6,8.25;2,0.5;back;]] .. S("Back") .. [[]
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[0,0;5.75,9;contacts;#999,]] .. S("Name") .. "," .. S("Note") table[0,0;5.75,9;contacts;]] .. mail.colors.header .. "," .. S("Name") .. "," .. S("Note")
function mail.show_contacts(name) function mail.show_contacts(name)

View File

@ -21,7 +21,7 @@ function mail.show_drafts(name)
button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[] button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[]
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[0,0.7;5.75,9.35;drafts;#999,]] .. S("To") .. "," .. S("Subject") table[0,0.7;5.75,9.35;drafts;]] .. mail.colors.header .. "," .. S("To") .. "," .. S("Subject")
local formspec = { drafts_formspec } local formspec = { drafts_formspec }
local entry = mail.get_storage_entry(name) local entry = mail.get_storage_entry(name)

View File

@ -48,7 +48,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[] button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[]
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[0,0.7;5.75,7.45;inbox;#999,]] .. S("From") .. "," .. S("Subject") table[0,0.7;5.75,7.45;inbox;]] .. mail.colors.header .. "," .. S("From") .. "," .. S("Subject")
local formspec = { inbox_formspec } local formspec = { inbox_formspec }
mail.message_drafts[name] = nil mail.message_drafts[name] = nil
@ -71,27 +71,27 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
if selected_id > 0 then if selected_id > 0 then
if not message.read and unread_color_enable then if not message.read and unread_color_enable then
if not mail.player_in_list(name, message.to) and cc_color_enable then if not mail.player_in_list(name, message.to) and cc_color_enable then
formspec[#formspec + 1] = ",#A39E5D" formspec[#formspec + 1] = "," .. mail.colors.imp_add_sel
else else
formspec[#formspec + 1] = ",#A39E19" formspec[#formspec + 1] = "," .. mail.colors.imp_sel
end end
else else
if not mail.player_in_list(name, message.to) and cc_color_enable then if not mail.player_in_list(name, message.to) and cc_color_enable then
formspec[#formspec + 1] = ",#899888" formspec[#formspec + 1] = "," .. mail.colors.add_sel
else else
formspec[#formspec + 1] = ",#466432" formspec[#formspec + 1] = "," .. mail.colors.selected
end end
end end
else else
if not message.read and unread_color_enable then if not message.read and unread_color_enable then
if not mail.player_in_list(name, message.to) and cc_color_enable then if not mail.player_in_list(name, message.to) and cc_color_enable then
formspec[#formspec + 1] = ",#FFD788" formspec[#formspec + 1] = "," .. mail.colors.imp_add
else else
formspec[#formspec + 1] = ",#FFD700" formspec[#formspec + 1] = "," .. mail.colors.important
end end
else else
if not mail.player_in_list(name, message.to) and cc_color_enable then if not mail.player_in_list(name, message.to) and cc_color_enable then
formspec[#formspec + 1] = ",#CCCCDD" formspec[#formspec + 1] = "," .. mail.colors.additional
else else
formspec[#formspec + 1] = "," formspec[#formspec + 1] = ","
end end

View File

@ -9,7 +9,7 @@ local maillists_formspec = "size[8,9;]" .. mail.theme .. [[
button[6,1.60;2,0.5;delete;]] .. S("Delete") .. [[] button[6,1.60;2,0.5;delete;]] .. S("Delete") .. [[]
button[6,8.25;2,0.5;back;]] .. S("Back") .. [[] button[6,8.25;2,0.5;back;]] .. S("Back") .. [[]
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[0,0;5.75,9;maillists;#999,]] .. S("Name") .. "," .. S("Note") table[0,0;5.75,9;maillists;]] .. mail.colors.header .. "," .. S("Name") .. "," .. S("Note")
function mail.show_maillists(name) function mail.show_maillists(name)
local formspec = { maillists_formspec } local formspec = { maillists_formspec }

View File

@ -9,7 +9,7 @@ function mail.show_message(name, id)
local formspec = [[ local formspec = [[
size[8,9] size[8,9]
box[0,0;7,1.9;#466432] box[0,0;7,1.9;]] .. mail.colors.highlighted .. [[]
button[7.25,0.15;0.75,0.5;back;X] button[7.25,0.15;0.75,0.5;back;X]

View File

@ -46,7 +46,7 @@ function mail.show_outbox(name, sortfieldindex, sortdirection, filter)
button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[] button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[]
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[0,0.7;5.75,7.45;outbox;#999,]] .. S("To") .. "," .. S("Subject") table[0,0.7;5.75,7.45;outbox;]] .. mail.colors.header .. "," .. S("To") .. "," .. S("Subject")
local formspec = { outbox_formspec } local formspec = { outbox_formspec }
mail.message_drafts[name] = nil mail.message_drafts[name] = nil
@ -64,7 +64,7 @@ function mail.show_outbox(name, sortfieldindex, sortdirection, filter)
end end
end end
if selected_id > 0 then if selected_id > 0 then
formspec[#formspec + 1] = ",#466432" formspec[#formspec + 1] = "," .. mail.colors.selected
else else
formspec[#formspec + 1] = "," formspec[#formspec + 1] = ","
end end

View File

@ -5,15 +5,15 @@ local FORMNAME = "mail:selectcontact"
local select_contact_formspec = "size[8,9;]" .. mail.theme .. [[ local select_contact_formspec = "size[8,9;]" .. mail.theme .. [[
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[0,0;3.5,9;contacts;#999,]] .. S("Name") .. "," .. S("Note") .. [[%s] table[0,0;3.5,9;contacts;]] .. mail.colors.header .. "," .. S("Name") .. "," .. S("Note") .. [[%s]
button[3.55,2.00;1.75,0.5;toadd; ]] .. S("Add") .. [[] button[3.55,2.00;1.75,0.5;toadd; ]] .. S("Add") .. [[]
button[3.55,2.75;1.75,0.5;toremove; ]] .. S("Remove") .. [[] button[3.55,2.75;1.75,0.5;toremove; ]] .. S("Remove") .. [[]
button[3.55,6.00;1.75,0.5;ccadd; ]] .. S("Add") .. [[] button[3.55,6.00;1.75,0.5;ccadd; ]] .. S("Add") .. [[]
button[3.55,6.75;1.75,0.5;ccremove; ]] .. S("Remove") .. [[] button[3.55,6.75;1.75,0.5;ccremove; ]] .. S("Remove") .. [[]
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[5.15,0.0;2.75,4.5;to;#999,]] .. S("To") .. ":," .. S("Note") .. [[%s] table[5.15,0.0;2.75,4.5;to;]] .. mail.colors.header .. "," .. S("To") .. ":," .. S("Note") .. [[%s]
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[5.15,4.6;2.75,4.5;cc;#999,]] .. S("CC") .. ":," .. S("Note") .. [[%s] table[5.15,4.6;2.75,4.5;cc;]] .. mail.colors.header .. "," .. S("CC") .. ":," .. S("Note") .. [[%s]
button[3.55,8.25;1.75,0.5;back;]] .. S("Back") .. [[] button[3.55,8.25;1.75,0.5;back;]] .. S("Back") .. [[]
]] ]]

View File

@ -9,7 +9,7 @@ function mail.show_settings(name)
tabheader[0.3,1;optionstab;]] .. S("Settings") .. "," .. S("About") .. [[;1;false;false] tabheader[0.3,1;optionstab;]] .. S("Settings") .. "," .. S("About") .. [[;1;false;false]
button[9.35,0;0.75,0.5;back;X] button[9.35,0;0.75,0.5;back;X]
box[0,0.8;3,0.45;#466432] box[0,0.8;3,0.45;]] .. mail.colors.highlighted .. [[]
label[0.2,0.8;]] .. S("Notifications") .. [[] label[0.2,0.8;]] .. S("Notifications") .. [[]
checkbox[0,1.2;chat_notifications;]] .. S("Chat notifications") .. [[;]] .. checkbox[0,1.2;chat_notifications;]] .. S("Chat notifications") .. [[;]] ..
tostring(mail.get_setting(name, "chat_notifications")) .. [[] tostring(mail.get_setting(name, "chat_notifications")) .. [[]
@ -20,7 +20,7 @@ function mail.show_settings(name)
checkbox[0,2.4;sound_notifications;]] .. S("Sound notifications") .. [[;]] .. checkbox[0,2.4;sound_notifications;]] .. S("Sound notifications") .. [[;]] ..
tostring(mail.get_setting(name, "sound_notifications")) .. [[] tostring(mail.get_setting(name, "sound_notifications")) .. [[]
box[5,0.8;3,0.45;#466432] box[5,0.8;3,0.45;]] .. mail.colors.highlighted .. [[]
label[5.2,0.8;]] .. S("Message list") .. [[] label[5.2,0.8;]] .. S("Message list") .. [[]
checkbox[5,1.2;unreadcolorenable;]] .. S("Show unread in different color") .. [[;]] .. checkbox[5,1.2;unreadcolorenable;]] .. S("Show unread in different color") .. [[;]] ..
tostring(mail.get_setting(name, "unreadcolorenable")) .. [[] tostring(mail.get_setting(name, "unreadcolorenable")) .. [[]
@ -35,7 +35,7 @@ function mail.show_settings(name)
S("Ascending") .. "," .. S("Descending") .. [[;]] .. S("Ascending") .. "," .. S("Descending") .. [[;]] ..
tostring(mail.get_setting(name, "defaultsortdirection")) .. [[;true] tostring(mail.get_setting(name, "defaultsortdirection")) .. [[;true]
box[0,3.2;3,0.45;#466432] box[0,3.2;3,0.45;]] .. mail.colors.highlighted .. [[]
label[0.2,3.2;]] .. S("Other") .. [[] label[0.2,3.2;]] .. S("Other") .. [[]
checkbox[0,3.6;trash_move_enable;]] .. S("Move deleted messages to trash") .. [[;]] .. checkbox[0,3.6;trash_move_enable;]] .. S("Move deleted messages to trash") .. [[;]] ..
tostring(mail.get_setting(name, "trash_move_enable")) .. [[] tostring(mail.get_setting(name, "trash_move_enable")) .. [[]

View File

@ -16,7 +16,7 @@ local trash_formspec = "size[8.5,10;]" .. mail.theme .. [[
button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[] button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[]
tablecolumns[color;text;text] tablecolumns[color;text;text]
table[0,0.7;5.75,9.35;trash;#999,]] .. S("From/To") .. "," .. S("Subject") table[0,0.7;5.75,9.35;trash;]] .. mail.colors.header .. "," .. S("From/To") .. "," .. S("Subject")
function mail.show_trash(name) function mail.show_trash(name)