about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-01-25 00:27:56 +0000
committerJames Booth <boothj5@gmail.com>2016-01-25 00:27:56 +0000
commit45a1c66e87afbedb4d4f0c417461a3a29b5d032d (patch)
treed113267e0f5c01bb2d01860bac0fedc5b1948a51 /src/config
parent0ae975c27f2b5f9a47a7434138c0ae328b06a7a6 (diff)
downloadprofani-tty-45a1c66e87afbedb4d4f0c417461a3a29b5d032d.tar.gz
Themes: Tidy foreground colour loading
Diffstat (limited to 'src/config')
-rw-r--r--src/config/theme.c141
1 files changed, 71 insertions, 70 deletions
diff --git a/src/config/theme.c b/src/config/theme.c
index 10bbb0af..e04a5d4a 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -655,10 +655,11 @@ _theme_prep_bgnd(char *setting, char *def, GString *lookup_str)
 }
 
 static void
-_theme_prep_fgnd(char *setting, char *def, GString *lookup_str, gboolean *bold)
+_theme_prep_fgnd(char *setting, GString *lookup_str, gboolean *bold)
 {
     gchar *val = g_key_file_get_string(theme, "colours", setting, NULL);
     if (!val) {
+        char *def = g_hash_table_lookup(defaults, setting);
         g_string_append(lookup_str, def);
     } else {
         if (g_str_has_prefix(val, "bold_")) {
@@ -701,75 +702,75 @@ theme_attrs(theme_item_t attrs)
 
     // get forground colour
     switch (attrs) {
-    case THEME_TEXT:                    _theme_prep_fgnd("main.text",               "white",    lookup_str, &bold); break;
-    case THEME_TEXT_ME:                 _theme_prep_fgnd("main.text.me",            "white",    lookup_str, &bold); break;
-    case THEME_TEXT_THEM:               _theme_prep_fgnd("main.text.them",          "white",    lookup_str, &bold); break;
-    case THEME_SPLASH:                  _theme_prep_fgnd("main.splash",             "cyan",     lookup_str, &bold); break;
-    case THEME_ERROR:                   _theme_prep_fgnd("error",                   "red",      lookup_str, &bold); break;
-    case THEME_INCOMING:                _theme_prep_fgnd("incoming",                "yellow",   lookup_str, &bold); break;
-    case THEME_INPUT_TEXT:              _theme_prep_fgnd("input.text",              "white",    lookup_str, &bold); break;
-    case THEME_TIME:                    _theme_prep_fgnd("main.time",               "white",    lookup_str, &bold); break;
-    case THEME_TITLE_TEXT:              _theme_prep_fgnd("titlebar.text",           "white",    lookup_str, &bold); break;
-    case THEME_TITLE_BRACKET:           _theme_prep_fgnd("titlebar.brackets",       "cyan",     lookup_str, &bold); break;
-    case THEME_TITLE_UNENCRYPTED:       _theme_prep_fgnd("titlebar.unencrypted",    "red",      lookup_str, &bold); break;
-    case THEME_TITLE_ENCRYPTED:         _theme_prep_fgnd("titlebar.encrypted",      "white",    lookup_str, &bold); break;
-    case THEME_TITLE_UNTRUSTED:         _theme_prep_fgnd("titlebar.untrusted",      "yellow",   lookup_str, &bold); break;
-    case THEME_TITLE_TRUSTED:           _theme_prep_fgnd("titlebar.trusted",        "white",    lookup_str, &bold); break;
-    case THEME_TITLE_ONLINE:            _theme_prep_fgnd("titlebar.online",         "white",    lookup_str, &bold); break;
-    case THEME_TITLE_OFFLINE:           _theme_prep_fgnd("titlebar.offline",        "white",    lookup_str, &bold); break;
-    case THEME_TITLE_AWAY:              _theme_prep_fgnd("titlebar.away",           "white",    lookup_str, &bold); break;
-    case THEME_TITLE_CHAT:              _theme_prep_fgnd("titlebar.chat",           "white",    lookup_str, &bold); break;
-    case THEME_TITLE_DND:               _theme_prep_fgnd("titlebar.dnd",            "white",    lookup_str, &bold); break;
-    case THEME_TITLE_XA:                _theme_prep_fgnd("titlebar.xa",             "white",    lookup_str, &bold); break;
-    case THEME_STATUS_TEXT:             _theme_prep_fgnd("statusbar.text",          "white",    lookup_str, &bold); break;
-    case THEME_STATUS_BRACKET:          _theme_prep_fgnd("statusbar.brackets",      "cyan",     lookup_str, &bold); break;
-    case THEME_STATUS_ACTIVE:           _theme_prep_fgnd("statusbar.active",        "cyan",     lookup_str, &bold); break;
-    case THEME_STATUS_NEW:              _theme_prep_fgnd("statusbar.new",           "white",    lookup_str, &bold); break;
-    case THEME_ME:                      _theme_prep_fgnd("me",                      "yellow",   lookup_str, &bold); break;
-    case THEME_THEM:                    _theme_prep_fgnd("them",                    "green",    lookup_str, &bold); break;
-    case THEME_RECEIPT_SENT:            _theme_prep_fgnd("receipt.sent",            "red",      lookup_str, &bold); break;
-    case THEME_ROOMINFO:                _theme_prep_fgnd("roominfo",                "yellow",   lookup_str, &bold); break;
-    case THEME_ROOMMENTION:             _theme_prep_fgnd("roommention",             "yellow",   lookup_str, &bold); break;
-    case THEME_ROOMTRIGGER:             _theme_prep_fgnd("roomtrigger",             "yellow",   lookup_str, &bold); break;
-    case THEME_ONLINE:                  _theme_prep_fgnd("online",                  "green",    lookup_str, &bold); break;
-    case THEME_OFFLINE:                 _theme_prep_fgnd("offline",                 "red",      lookup_str, &bold); break;
-    case THEME_AWAY:                    _theme_prep_fgnd("away",                    "cyan",     lookup_str, &bold); break;
-    case THEME_CHAT:                    _theme_prep_fgnd("chat",                    "green",    lookup_str, &bold); break;
-    case THEME_DND:                     _theme_prep_fgnd("dnd",                     "red",      lookup_str, &bold); break;
-    case THEME_XA:                      _theme_prep_fgnd("xa",                      "cyan",     lookup_str, &bold); break;
-    case THEME_TYPING:                  _theme_prep_fgnd("typing",                  "yellow",   lookup_str, &bold); break;
-    case THEME_GONE:                    _theme_prep_fgnd("gone",                    "red",      lookup_str, &bold); break;
-    case THEME_SUBSCRIBED:              _theme_prep_fgnd("subscribed",              "green",    lookup_str, &bold); break;
-    case THEME_UNSUBSCRIBED:            _theme_prep_fgnd("unsubscribed",            "red",      lookup_str, &bold); break;
-    case THEME_OTR_STARTED_TRUSTED:     _theme_prep_fgnd("otr.started.trusted",     "green",    lookup_str, &bold); break;
-    case THEME_OTR_STARTED_UNTRUSTED:   _theme_prep_fgnd("otr.started.untrusted",   "yellow",   lookup_str, &bold); break;
-    case THEME_OTR_ENDED:               _theme_prep_fgnd("otr.ended",               "red",      lookup_str, &bold); break;
-    case THEME_OTR_TRUSTED:             _theme_prep_fgnd("otr.trusted",             "green",    lookup_str, &bold); break;
-    case THEME_OTR_UNTRUSTED:           _theme_prep_fgnd("otr.untrusted",           "yellow",   lookup_str, &bold); break;
-    case THEME_ROSTER_HEADER:           _theme_prep_fgnd("roster.header",           "yellow",   lookup_str, &bold); break;
-    case THEME_ROSTER_ONLINE:           _theme_prep_fgnd("roster.online",           "green",    lookup_str, &bold); break;
-    case THEME_ROSTER_OFFLINE:          _theme_prep_fgnd("roster.offline",          "red",      lookup_str, &bold); break;
-    case THEME_ROSTER_CHAT:             _theme_prep_fgnd("roster.chat",             "green",    lookup_str, &bold); break;
-    case THEME_ROSTER_AWAY:             _theme_prep_fgnd("roster.away",             "cyan",     lookup_str, &bold); break;
-    case THEME_ROSTER_DND:              _theme_prep_fgnd("roster.dnd",              "red",      lookup_str, &bold); break;
-    case THEME_ROSTER_XA:               _theme_prep_fgnd("roster.xa",               "cyan",     lookup_str, &bold); break;
-    case THEME_ROSTER_ONLINE_ACTIVE:    _theme_prep_fgnd("roster.online.active",    "green",    lookup_str, &bold); break;
-    case THEME_ROSTER_OFFLINE_ACTIVE:   _theme_prep_fgnd("roster.offline.active",   "red",      lookup_str, &bold); break;
-    case THEME_ROSTER_CHAT_ACTIVE:      _theme_prep_fgnd("roster.chat.active",      "green",    lookup_str, &bold); break;
-    case THEME_ROSTER_AWAY_ACTIVE:      _theme_prep_fgnd("roster.away.active",      "cyan",     lookup_str, &bold); break;
-    case THEME_ROSTER_DND_ACTIVE:       _theme_prep_fgnd("roster.dnd.active",       "red",      lookup_str, &bold); break;
-    case THEME_ROSTER_XA_ACTIVE:        _theme_prep_fgnd("roster.xa.active",        "cyan",     lookup_str, &bold); break;
-    case THEME_ROSTER_ONLINE_UNREAD:    _theme_prep_fgnd("roster.online.unread",    "green",    lookup_str, &bold); break;
-    case THEME_ROSTER_OFFLINE_UNREAD:   _theme_prep_fgnd("roster.offline.unread",   "red",      lookup_str, &bold); break;
-    case THEME_ROSTER_CHAT_UNREAD:      _theme_prep_fgnd("roster.chat.unread",      "green",    lookup_str, &bold); break;
-    case THEME_ROSTER_AWAY_UNREAD:      _theme_prep_fgnd("roster.away.unread",      "cyan",     lookup_str, &bold); break;
-    case THEME_ROSTER_DND_UNREAD:       _theme_prep_fgnd("roster.dnd.unread",       "red",      lookup_str, &bold); break;
-    case THEME_ROSTER_XA_UNREAD:        _theme_prep_fgnd("roster.xa.unread",        "cyan",     lookup_str, &bold); break;
-    case THEME_ROSTER_ROOM:             _theme_prep_fgnd("roster.room",             "green",    lookup_str, &bold); break;
-    case THEME_ROSTER_ROOM_UNREAD:      _theme_prep_fgnd("roster.room.unread",      "green",    lookup_str, &bold); break;
-    case THEME_ROSTER_ROOM_TRIGGER:     _theme_prep_fgnd("roster.room.trigger",     "green",    lookup_str, &bold); break;
-    case THEME_ROSTER_ROOM_MENTION:     _theme_prep_fgnd("roster.room.mention",     "green",    lookup_str, &bold); break;
-    case THEME_OCCUPANTS_HEADER:        _theme_prep_fgnd("occupants.header",        "yellow",   lookup_str, &bold); break;
+    case THEME_TEXT:                    _theme_prep_fgnd("main.text",               lookup_str, &bold); break;
+    case THEME_TEXT_ME:                 _theme_prep_fgnd("main.text.me",            lookup_str, &bold); break;
+    case THEME_TEXT_THEM:               _theme_prep_fgnd("main.text.them",          lookup_str, &bold); break;
+    case THEME_SPLASH:                  _theme_prep_fgnd("main.splash",             lookup_str, &bold); break;
+    case THEME_ERROR:                   _theme_prep_fgnd("error",                   lookup_str, &bold); break;
+    case THEME_INCOMING:                _theme_prep_fgnd("incoming",                lookup_str, &bold); break;
+    case THEME_INPUT_TEXT:              _theme_prep_fgnd("input.text",              lookup_str, &bold); break;
+    case THEME_TIME:                    _theme_prep_fgnd("main.time",               lookup_str, &bold); break;
+    case THEME_TITLE_TEXT:              _theme_prep_fgnd("titlebar.text",           lookup_str, &bold); break;
+    case THEME_TITLE_BRACKET:           _theme_prep_fgnd("titlebar.brackets",       lookup_str, &bold); break;
+    case THEME_TITLE_UNENCRYPTED:       _theme_prep_fgnd("titlebar.unencrypted",    lookup_str, &bold); break;
+    case THEME_TITLE_ENCRYPTED:         _theme_prep_fgnd("titlebar.encrypted",      lookup_str, &bold); break;
+    case THEME_TITLE_UNTRUSTED:         _theme_prep_fgnd("titlebar.untrusted",      lookup_str, &bold); break;
+    case THEME_TITLE_TRUSTED:           _theme_prep_fgnd("titlebar.trusted",        lookup_str, &bold); break;
+    case THEME_TITLE_ONLINE:            _theme_prep_fgnd("titlebar.online",         lookup_str, &bold); break;
+    case THEME_TITLE_OFFLINE:           _theme_prep_fgnd("titlebar.offline",        lookup_str, &bold); break;
+    case THEME_TITLE_AWAY:              _theme_prep_fgnd("titlebar.away",           lookup_str, &bold); break;
+    case THEME_TITLE_CHAT:              _theme_prep_fgnd("titlebar.chat",           lookup_str, &bold); break;
+    case THEME_TITLE_DND:               _theme_prep_fgnd("titlebar.dnd",            lookup_str, &bold); break;
+    case THEME_TITLE_XA:                _theme_prep_fgnd("titlebar.xa",             lookup_str, &bold); break;
+    case THEME_STATUS_TEXT:             _theme_prep_fgnd("statusbar.text",          lookup_str, &bold); break;
+    case THEME_STATUS_BRACKET:          _theme_prep_fgnd("statusbar.brackets",      lookup_str, &bold); break;
+    case THEME_STATUS_ACTIVE:           _theme_prep_fgnd("statusbar.active",        lookup_str, &bold); break;
+    case THEME_STATUS_NEW:              _theme_prep_fgnd("statusbar.new",           lookup_str, &bold); break;
+    case THEME_ME:                      _theme_prep_fgnd("me",                      lookup_str, &bold); break;
+    case THEME_THEM:                    _theme_prep_fgnd("them",                    lookup_str, &bold); break;
+    case THEME_RECEIPT_SENT:            _theme_prep_fgnd("receipt.sent",            lookup_str, &bold); break;
+    case THEME_ROOMINFO:                _theme_prep_fgnd("roominfo",                lookup_str, &bold); break;
+    case THEME_ROOMMENTION:             _theme_prep_fgnd("roommention",             lookup_str, &bold); break;
+    case THEME_ROOMTRIGGER:             _theme_prep_fgnd("roomtrigger",             lookup_str, &bold); break;
+    case THEME_ONLINE:                  _theme_prep_fgnd("online",                  lookup_str, &bold); break;
+    case THEME_OFFLINE:                 _theme_prep_fgnd("offline",                 lookup_str, &bold); break;
+    case THEME_AWAY:                    _theme_prep_fgnd("away",                    lookup_str, &bold); break;
+    case THEME_CHAT:                    _theme_prep_fgnd("chat",                    lookup_str, &bold); break;
+    case THEME_DND:                     _theme_prep_fgnd("dnd",                     lookup_str, &bold); break;
+    case THEME_XA:                      _theme_prep_fgnd("xa",                      lookup_str, &bold); break;
+    case THEME_TYPING:                  _theme_prep_fgnd("typing",                  lookup_str, &bold); break;
+    case THEME_GONE:                    _theme_prep_fgnd("gone",                    lookup_str, &bold); break;
+    case THEME_SUBSCRIBED:              _theme_prep_fgnd("subscribed",              lookup_str, &bold); break;
+    case THEME_UNSUBSCRIBED:            _theme_prep_fgnd("unsubscribed",            lookup_str, &bold); break;
+    case THEME_OTR_STARTED_TRUSTED:     _theme_prep_fgnd("otr.started.trusted",     lookup_str, &bold); break;
+    case THEME_OTR_STARTED_UNTRUSTED:   _theme_prep_fgnd("otr.started.untrusted",   lookup_str, &bold); break;
+    case THEME_OTR_ENDED:               _theme_prep_fgnd("otr.ended",               lookup_str, &bold); break;
+    case THEME_OTR_TRUSTED:             _theme_prep_fgnd("otr.trusted",             lookup_str, &bold); break;
+    case THEME_OTR_UNTRUSTED:           _theme_prep_fgnd("otr.untrusted",           lookup_str, &bold); break;
+    case THEME_ROSTER_HEADER:           _theme_prep_fgnd("roster.header",           lookup_str, &bold); break;
+    case THEME_ROSTER_ONLINE:           _theme_prep_fgnd("roster.online",           lookup_str, &bold); break;
+    case THEME_ROSTER_OFFLINE:          _theme_prep_fgnd("roster.offline",          lookup_str, &bold); break;
+    case THEME_ROSTER_CHAT:             _theme_prep_fgnd("roster.chat",             lookup_str, &bold); break;
+    case THEME_ROSTER_AWAY:             _theme_prep_fgnd("roster.away",             lookup_str, &bold); break;
+    case THEME_ROSTER_DND:              _theme_prep_fgnd("roster.dnd",              lookup_str, &bold); break;
+    case THEME_ROSTER_XA:               _theme_prep_fgnd("roster.xa",               lookup_str, &bold); break;
+    case THEME_ROSTER_ONLINE_ACTIVE:    _theme_prep_fgnd("roster.online.active",    lookup_str, &bold); break;
+    case THEME_ROSTER_OFFLINE_ACTIVE:   _theme_prep_fgnd("roster.offline.active",   lookup_str, &bold); break;
+    case THEME_ROSTER_CHAT_ACTIVE:      _theme_prep_fgnd("roster.chat.active",      lookup_str, &bold); break;
+    case THEME_ROSTER_AWAY_ACTIVE:      _theme_prep_fgnd("roster.away.active",      lookup_str, &bold); break;
+    case THEME_ROSTER_DND_ACTIVE:       _theme_prep_fgnd("roster.dnd.active",       lookup_str, &bold); break;
+    case THEME_ROSTER_XA_ACTIVE:        _theme_prep_fgnd("roster.xa.active",        lookup_str, &bold); break;
+    case THEME_ROSTER_ONLINE_UNREAD:    _theme_prep_fgnd("roster.online.unread",    lookup_str, &bold); break;
+    case THEME_ROSTER_OFFLINE_UNREAD:   _theme_prep_fgnd("roster.offline.unread",   lookup_str, &bold); break;
+    case THEME_ROSTER_CHAT_UNREAD:      _theme_prep_fgnd("roster.chat.unread",      lookup_str, &bold); break;
+    case THEME_ROSTER_AWAY_UNREAD:      _theme_prep_fgnd("roster.away.unread",      lookup_str, &bold); break;
+    case THEME_ROSTER_DND_UNREAD:       _theme_prep_fgnd("roster.dnd.unread",       lookup_str, &bold); break;
+    case THEME_ROSTER_XA_UNREAD:        _theme_prep_fgnd("roster.xa.unread",        lookup_str, &bold); break;
+    case THEME_ROSTER_ROOM:             _theme_prep_fgnd("roster.room",             lookup_str, &bold); break;
+    case THEME_ROSTER_ROOM_UNREAD:      _theme_prep_fgnd("roster.room.unread",      lookup_str, &bold); break;
+    case THEME_ROSTER_ROOM_TRIGGER:     _theme_prep_fgnd("roster.room.trigger",     lookup_str, &bold); break;
+    case THEME_ROSTER_ROOM_MENTION:     _theme_prep_fgnd("roster.room.mention",     lookup_str, &bold); break;
+    case THEME_OCCUPANTS_HEADER:        _theme_prep_fgnd("occupants.header",        lookup_str, &bold); break;
     case THEME_WHITE:                   g_string_append(lookup_str, "white");   bold = FALSE;   break;
     case THEME_WHITE_BOLD:              g_string_append(lookup_str, "white");   bold = TRUE;    break;
     case THEME_GREEN:                   g_string_append(lookup_str, "green");   bold = FALSE;   break;