From mboxrd@z Thu Jan 1 00:00:00 1970 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 28 Apr 2008 15:28:29 -0700 Subject: [sup-talk] [PATCH] use any custom colors configured in config.yaml In-Reply-To: <1209150616-sup-8211@psilocybic> References: <1209150616-sup-8211@psilocybic> Message-ID: <1209421539-sup-5981@south> Hi Dag, Thanks for the patch! People have been clamoring for this functionality forever and I have been cruelly not doing it for them. A few minor comments: Reformatted excerpts from Dag Odenhall's message of 2008-04-25: > + confcolor = $config[:colors][sym.to_s[0..-7].to_sym] rescue nil > + fg = Curses.const_get "COLOR_#{confcolor[:fg].upcase}" rescue fg > + bg = Curses.const_get "COLOR_#{confcolor[:bg].upcase}" rescue bg > + attrs = confcolor[:attrs].map {|a| Curses.const_get "A_#{a.upcase}" } rescue attrs 1. Can you wrap all this in an if statement, rather than having sequence of post-fix rescue stuff? You could do something like "if(confcolor = $config[...)" and set fg and bg within that. 2. Errors in the color names will be silently ignored. The NameError exception should be caught and turned into a BufferManager.flash and a Redwood::log to inform the user. 3. Since I feel like people will write a lot of these descriptions, I would load in colors from a colors.yaml file instead of from the config file. (I can do this one instead if you're unsure.) -- William