diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-03-18 15:13:15 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-03-18 15:13:15 -0500 |
commit | e156e0114f9a4b3392846b362ed31c38efa66062 (patch) | |
tree | d9e4004ba6d351e7ffd14574c5dc9170ae2e3db7 | |
parent | 3af5385dd6caff4ca9344a222a882dd3d71c2069 (diff) | |
download | luancurses-e156e0114f9a4b3392846b362ed31c38efa66062.tar.gz luancurses-e156e0114f9a4b3392846b362ed31c38efa66062.zip |
default to using default colors in color pairs if we have initialized the default color
-rw-r--r-- | src/curses.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/curses.c b/src/curses.c index 564bdbf..09e76d6 100644 --- a/src/curses.c +++ b/src/curses.c @@ -13,7 +13,7 @@ typedef struct _pos { int y; } pos; -static int ncolors = 0, ncolor_pairs = 0; +static int ncolors = 0, ncolor_pairs = 0, default_color_available = 0; static int get_color_pair(lua_State* L, const char* str) { @@ -303,8 +303,14 @@ static int l_init_pair(lua_State* L) /* check the arguments, and get them */ name = luaL_checklstring(L, 1, NULL); - fg = luaL_optlstring(L, 2, "white", NULL); - bg = luaL_optlstring(L, 3, "black", NULL); + if (default_color_available) { + fg = luaL_optlstring(L, 2, "default", NULL); + bg = luaL_optlstring(L, 3, "default", NULL); + } + else { + fg = luaL_optlstring(L, 2, "white", NULL); + bg = luaL_optlstring(L, 3, "black", NULL); + } lua_getfield(L, LUA_REGISTRYINDEX, REG_TABLE); |