darcs patch: WindowNavigation: add configurable colors and the poss...

Hi,
this incorporates both my job and Jamie's patch to turn off navigation
colors.
To be applied only with David (and Jamie) approval.
Andrea
Wed Oct 3 11:00:17 CEST 2007 Andrea Rossato

On Wed, Oct 03, 2007 at 11:04:19AM +0200, Andrea Rossato wrote:
Hi,
this incorporates both my job and Jamie's patch to turn off navigation colors.
To be applied only with David (and Jamie) approval.
Approved. But I've a few ideas for improvements (see below).
Wed Oct 3 11:00:17 CEST 2007 Andrea Rossato
* WindowNavigation: add configurable colors and the possibility to turn them off
+data WNConfig = + WNC { showNavigable :: Bool + , upColor :: String + , downColor :: String + , leftColor :: String + , rightColor :: String + } deriving (Show, Read) + +defaultWNConfig :: WNConfig +defaultWNConfig = WNC True "#0000FF" "#00FFFF" "#FF0000" "#FF00FF"
I definitely vote for a more muted default. I set this gaudy color arrangement only for the purpose of debugging a situation where a wrong window was getting colored. I think the original suggester's idea of a muted red would be reasonable. Even better would be an automatic weighted average of borderNormal and borderFocussed (as the default). This would require something like: data WNConfig = WNC { showNavigable :: Bool , averageFocusAndNormal :: Double , upColor :: String , downColor :: String , leftColor :: String , rightColor :: String } deriving (Show, Read) Note that this average idea could be tricky. If both colors are of the form "#00ff00", then it's easy, we convert to three Ints and back. Otherwise, I think we'd have to involve X to compute the color values, and I'm not sure how to do that. I was also thinking that a couple of exported WNConfigs would be handy: noNavigateBorders :: WNConfig navigateColor :: String -> WNConfig etc. So that in common cases, user won't have to fool with fields of the structure. I also wouldn't mind (unless we've got a user interested in the multi-color option) going with a single configurable border color. In fact, I think it'd be ideal to avoid exporting the WNConfig constructor at all. But for now, I'd just go with your patch. -- David Roundy Department of Physics Oregon State University

On Wed, Oct 03, 2007 at 06:11:37AM -0700, David Roundy wrote:
muted red would be reasonable. Even better would be an automatic weighted average of borderNormal and borderFocussed (as the default). This would require something like:
data WNConfig = WNC { showNavigable :: Bool , averageFocusAndNormal :: Double [...]
Note that this average idea could be tricky. If both colors are of the form "#00ff00", then it's easy, we convert to three Ints and back. Otherwise, I think we'd have to involve X to compute the color values, and I'm not sure how to do that.
I don't thin I've already understood this weighted average stuff but it sounds cool and I'll try to implement it. Actually I'm going to put it on my TODO list... the best I can do right now.
I was also thinking that a couple of exported WNConfigs would be handy:
The rest of you requests seem very useful to me to and I'm going to send a patch soon. Andrea

On Wed, Oct 03, 2007 at 07:14:43PM +0200, Andrea Rossato wrote:
On Wed, Oct 03, 2007 at 06:11:37AM -0700, David Roundy wrote:
muted red would be reasonable. Even better would be an automatic weighted average of borderNormal and borderFocussed (as the default). This would require something like:
data WNConfig = WNC { showNavigable :: Bool , averageFocusAndNormal :: Double [...]
Note that this average idea could be tricky. If both colors are of the form "#00ff00", then it's easy, we convert to three Ints and back. Otherwise, I think we'd have to involve X to compute the color values, and I'm not sure how to do that.
I don't thin I've already understood this weighted average stuff but it sounds cool and I'll try to implement it. Actually I'm going to put it on my TODO list... the best I can do right now.
My idea is that if we can write functions like redComponent :: Color -> Double -- ranges from zero to one greenComponent :: Color -> Double -- ranges from zero to one blueComponent :: Color -> Double -- ranges from zero to one newColor :: Double -> Double -> Double -> X Color -- rgb then we could do something like: do fc <- asks focusedBorder nc <- asks normalBorder let f = max 1 $ min 0 $ frac n = 1 - f combine comp = f*(comp fc) + n*(comp nc) defaultBorder <- newColor (combine redComponent) (combine greenComponent) (combine blueComponent) But I'm not sure how to extract the components of a color. Constructing a new color with given components seems relatively easy, just by printing the values out as a hex string.
I was also thinking that a couple of exported WNConfigs would be handy:
The rest of you requests seem very useful to me to and I'm going to send a patch soon.
That'd be great! -- David Roundy Department of Physics Oregon State University

On 2007-10-03 11:04:19 Andrea Rossato wrote:
Hi,
this incorporates both my job and Jamie's patch to turn off navigation colors.
To be applied only with David (and Jamie) approval.
Looks good to me! /J

On Wednesday 03 October 2007 04:04:19 Andrea Rossato wrote:
Hi,
this incorporates both my job and Jamie's patch to turn off navigation colors.
To be applied only with David (and Jamie) approval.
Andrea
Wed Oct 3 11:00:17 CEST 2007 Andrea Rossato
* WindowNavigation: add configurable colors and the possibility to turn them off
Applied.
participants (4)
-
Andrea Rossato
-
David Roundy
-
Jamie Webb
-
Spencer Janssen