diff --git a/changelog b/changelog index f65a2853b3b5..5b56d3250c69 100644 --- a/changelog +++ b/changelog @@ -26,6 +26,7 @@ Version 1.13.4+dev: * Improved the dialog for choosing what to do when a player leaves in multiplayer. * WML engine: + * Add color= attribute to [message]. * Fix some issues with [foreach] * Fix some issues with backstab-like weapon specials * Support [effect]times= diff --git a/data/core/about.cfg b/data/core/about.cfg index e8c776812767..4e4abf631bf2 100644 --- a/data/core/about.cfg +++ b/data/core/about.cfg @@ -1320,6 +1320,9 @@ name = "PaĆ­lo Ebermann (Pauxlo)" wikiuser = "Pauxlo" [/entry] + [entry] + name = "Pentarctagon" + [/entry] [entry] name = "Peter Elmers" [/entry] diff --git a/data/lua/wml/message.lua b/data/lua/wml/message.lua index 16c36e51847c..8847abbd5840 100644 --- a/data/lua/wml/message.lua +++ b/data/lua/wml/message.lua @@ -52,6 +52,131 @@ local function get_caption(cfg, speaker) return caption end +local function get_pango_color(color) + local pango_color = "#" + + -- if a hex color was passed in + -- or if a color string was passed in - contains no non-letter characters + -- just use that + if string.sub(color, 1, 1) == "#" or not string.match(color, "%A+") then + pango_color = color + -- decimal color was passed in, convert to hex color for pango + else + for s in string.gmatch(color, "%d+") do + pango_color = pango_color .. tonumber(s, 16) + end + end + + return pango_color +end + +-- add formatting +local function add_formatting(cfg, text) + -- span tag + local formatting = "" .. text .. "" + end + end + + -- or return unmodified message + return text +end + local function get_speaker(cfg) local speaker local context = wesnoth.current.event_context @@ -87,7 +212,10 @@ local function message_user_choice(cfg, speaker, options, text_input) msg_cfg.message = cfg.female_message end end - + + -- add formatting + msg_cfg.message = add_formatting(cfg, cfg.message) + -- Parse input text, if not available all fields are empty if text_input then local input_max_size = tonumber(text_input.max_length) or 256