Formatting of /theme properties command output

This commit is contained in:
James Booth
2016-01-23 22:55:04 +00:00
parent 6ec3f71a54
commit 2df622f9fd
3 changed files with 64 additions and 45 deletions

View File

@@ -1735,10 +1735,10 @@ static struct cmd_t command_defs[] =
CMD_DESC( CMD_DESC(
"Load a theme, includes colours and UI options.") "Load a theme, includes colours and UI options.")
CMD_ARGS( CMD_ARGS(
{ "list", "List all available themes." }, { "list", "List all available themes." },
{ "load <theme>", "Load the specified theme. 'default' will reset to the default theme." }, { "load <theme>", "Load the specified theme. 'default' will reset to the default theme." },
{ "colours", "Show the colour values as rendered by the terminal." }, { "colours", "Show colour values as rendered by the terminal." },
{ "properties", "Show each themed property." }) { "properties", "Show colour settings for current theme." })
CMD_EXAMPLES( CMD_EXAMPLES(
"/theme list", "/theme list",
"/theme load forest") "/theme load forest")

View File

@@ -2010,25 +2010,44 @@ void
_cons_theme_bar_prop(theme_item_t theme, char *prop) _cons_theme_bar_prop(theme_item_t theme, char *prop)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
GString *str = g_string_new(" ");
GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop);
win_print(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", propstr->str);
g_string_free(propstr, TRUE);
GString *valstr = g_string_new(" ");
char *setting = theme_get_string(prop); char *setting = theme_get_string(prop);
g_string_append_printf(str, "%-24s%s ", prop, setting); g_string_append_printf(valstr, "%s ", setting);
theme_free_string(setting); theme_free_string(setting);
win_print(console, '-', 0, NULL, NO_EOL, theme, "", str->str); win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, theme, "", valstr->str);
win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", ""); win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", "");
g_string_free(str, TRUE); g_string_free(valstr, TRUE);
} }
void void
_cons_theme_prop(theme_item_t theme, char *prop) _cons_theme_prop(theme_item_t theme, char *prop)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
GString *str = g_string_new(" ");
GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop);
win_print(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", propstr->str);
g_string_free(propstr, TRUE);
GString *valstr = g_string_new("");
char *setting = theme_get_string(prop); char *setting = theme_get_string(prop);
g_string_append_printf(str, "%-24s%s", prop, setting); g_string_append_printf(valstr, "%s", setting);
theme_free_string(setting); theme_free_string(setting);
win_print(console, '-', 0, NULL, 0, theme, "", str->str); win_print(console, '-', 0, NULL, NO_DATE, theme, "", valstr->str);
g_string_free(str, TRUE); g_string_free(valstr, TRUE);
// GString *str = g_string_new(" ");
// char *setting = theme_get_string(prop);
// g_string_append_printf(str, "%-24s%s", prop, setting);
// theme_free_string(setting);
// win_print(console, '-', 0, NULL, 0, theme, "", str->str);
// g_string_free(str, TRUE);
} }
void void

View File

@@ -18,56 +18,56 @@ statusbar.text=black
statusbar.brackets=black statusbar.brackets=black
statusbar.active=black statusbar.active=black
statusbar.new=black statusbar.new=black
main.text=white main.text=bold_white
main.text.me=cyan main.text.me=bold_white
main.text.them=bold_white main.text.them=bold_white
main.splash=bold_green main.splash=bold_green
main.time=black main.time=bold_green
input.text=bold_white input.text=bold_white
subscribed=bold_green subscribed=bold_green
unsubscribed=red unsubscribed=bold_red
otr.started.trusted=green otr.started.trusted=bold_green
otr.started.untrusted=yellow otr.started.untrusted=bold_yellow
otr.ended=red otr.ended=bold_red
otr.trusted=green otr.trusted=bold_green
otr.untrusted=yellow otr.untrusted=bold_yellow
online=bold_green online=bold_green
away=bold_cyan away=bold_cyan
chat=bold_white chat=bold_white
dnd=magenta dnd=bold_red
xa=bold_blue xa=bold_cyan
offline=red offline=bold_blue
incoming=bold_yellow incoming=bold_yellow
typing=yellow typing=bold_yellow
gone=red gone=bold_red
error=red error=bold_red
roominfo=yellow roominfo=bold_yellow
roommention=bold_red roommention=bold_green
me=blue me=bold_cyan
them=bold_green them=bold_magenta
roster.header=bold_yellow roster.header=bold_magenta
roster.chat=white roster.chat=white
roster.online=green roster.online=green
roster.away=cyan roster.away=cyan
roster.xa=blue roster.xa=cyan
roster.dnd=magenta roster.dnd=red
roster.offline=red roster.offline=bold_blue
roster.chat.active=white roster.chat.active=white
roster.online.active=green roster.online.active=green
roster.away.active=cyan roster.away.active=cyan
roster.xa.active=blue roster.xa.active=cyan
roster.dnd.active=magenta roster.dnd.active=red
roster.offline.active=red roster.offline.active=bold_blue
roster.chat.unread=bold_white roster.chat.unread=bold_white
roster.online.unread=bold_green roster.online.unread=bold_green
roster.away.unread=bold_cyan roster.away.unread=bold_cyan
roster.xa.unread=bold_blue roster.xa.unread=bold_cyan
roster.dnd.unread=bold_magenta roster.dnd.unread=bold_red
roster.offline.unread=bold_red roster.offline.unread=bold_blue
roster.room=green roster.room=bold_red
roster.room.unread=bold_green roster.room.unread=bold_magenta
occupants.header=bold_yellow occupants.header=bold_magenta
receipt.sent=bold_black receipt.sent=bold_blue
[ui] [ui]
beep=false beep=false