# HG changeset patch # User Sadrul Habib Chowdhury # Date 1196579765 0 # Node ID c9f02ad22269cbf3edb84feea76bbbe5afdc1717 # Parent ea56d93860813b8f8cabb109ecc669f1cd0b9a34 Try to reuse an existing color. diff -r ea56d9386081 -r c9f02ad22269 finch/libgnt/gntcolors.c --- a/finch/libgnt/gntcolors.c Sun Dec 02 06:01:52 2007 +0000 +++ b/finch/libgnt/gntcolors.c Sun Dec 02 07:16:05 2007 +0000 @@ -294,6 +294,13 @@ int gnt_color_add_pair(int fg, int bg) { + int i; + for (i = 1; i < custom_type; i++) { + short f, b; + if (pair_content(i, &f, &b) != ERR && + f == fg && b == bg) + return i; + } init_pair(custom_type, fg, bg); return custom_type++; }