about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-17 21:10:08 +0000
committerJames Booth <boothj5@gmail.com>2014-11-17 21:10:08 +0000
commit1d5ac1b4742bbd782a43da02a01f7e50476022b4 (patch)
treecd179cf541601d7b83dc8237968ecf32513caa16 /src/command
parent74d99375730f3be30ed8070c84148c6c1902ad7c (diff)
downloadprofani-tty-1d5ac1b4742bbd782a43da02a01f7e50476022b4.tar.gz
Added /theme colours command
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c11
-rw-r--r--src/command/commands.c8
2 files changed, 12 insertions, 7 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 3dcca100..c69e66d5 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -941,14 +941,14 @@ static struct cmd_t command_defs[] =
 
     { "/theme",
         cmd_theme, parse_args, 1, 2, &cons_theme_setting,
-        { "/theme command [theme-name]", "Change colour theme.",
-        { "/theme command [theme-name]",
+        { "/theme list|set [theme-name]", "Change colour theme.",
+        { "/theme list|set [theme-name]",
           "---------------------------",
           "Change the colour settings used.",
           "",
-          "command : One of the following,",
-          "list             : List all available themes.",
-          "set [theme-name] : Load the named theme.\"default\" will reset to the default colours.",
+          "list           : List all available themes.",
+          "set theme-name : Load the named theme.\"default\" will reset to the default colours.",
+          "colours        : Show the colour values as rendered by the terminal.",
           "",
           "Example : /theme list",
           "Example : /theme set mycooltheme",
@@ -1201,6 +1201,7 @@ cmd_init(void)
     theme_ac = autocomplete_new();
     autocomplete_add(theme_ac, "list");
     autocomplete_add(theme_ac, "set");
+    autocomplete_add(theme_ac, "colours");
 
     disco_ac = autocomplete_new();
     autocomplete_add(disco_ac, "info");
diff --git a/src/command/commands.c b/src/command/commands.c
index 68d70779..ecb3b30c 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -703,13 +703,13 @@ gboolean
 cmd_theme(gchar **args, struct cmd_help_t help)
 {
     // list themes
-    if (strcmp(args[0], "list") == 0) {
+    if (g_strcmp0(args[0], "list") == 0) {
         GSList *themes = theme_list();
         cons_show_themes(themes);
         g_slist_free_full(themes, g_free);
 
     // load a theme
-    } else if (strcmp(args[0], "set") == 0) {
+    } else if (g_strcmp0(args[0], "set") == 0) {
         if (args[1] == NULL) {
             cons_show("Usage: %s", help.usage);
         } else if (theme_load(args[1])) {
@@ -720,6 +720,10 @@ cmd_theme(gchar **args, struct cmd_help_t help)
         } else {
             cons_show("Couldn't find theme: %s", args[1]);
         }
+
+    // show colours
+    } else if (g_strcmp0(args[0], "colours") == 0) {
+        cons_theme_colours();
     } else {
         cons_show("Usage: %s", help.usage);
     }