On 17 May 2002 17:38:30 +0000, Mikhael Goikhman wrote: > > On 17 May 2002 08:28:52 +0200, Olivier Chapuis wrote: > > > > - The result can be good (and even really cool) if the shadow color > > (fgsh) is well chosen (the font can come into the game too). > > At present time fgsh is computed as sh is computed from bg. This is > > not a definitive solution at all. Any idea is really welcome :o) > > In my humble opinion, there is a good effect when fgsh is: > > fgsh = (fg + 3 * bg) / 4 > > All 3 rgb components are evaluated independently unsing this formula. > > I.e. fgsh should be something between fg and bg, 3 times closer to bg. > At least it is much better for a default than "sh".
This formula produces soft shadows, it is ok for a default, because this does not disturb a user too much, but usually a user wants a more hard (contrast) text shadow. I think, this revised formula produces better results in some cases: fgsh = (5 * bg - fg) / 4 If bg is lighter than fg, the soft formula may be applied. And if fg and bg are too close one to other, set fgsh to 0, or maybe to (fg + bg) / 4. I used the following test (runs 2 minutes) for random fg and bg colors: *FvwmIdent: Font "shadowsize=2:xft:Luxi Mono:Roman:pixelsize=13" *FvwmIdent: Colorset 21 Next (XTerm) FvwmIdent # the leading minus is important -SendToModule FvwmPerl eval detach(); \ for (1 .. 20) { \ $f = 0; \ for $d (0 .. 2) { \ $a[$d] = int(rand(256)); \ $b[$d] = int(rand(256)); \ $c[$d] = int((5 * $b[$d] - $a[$d]) / 4); \ $c[$d] = int((3 * $b[$d] + $a[$d]) / 4) \ if $a[$d] < $b[$d] || $c[$d] < 0; \ $c[$d] = 0 if $a[$d] - $b[$d] < 32 && \ $a[$d] - $b[$d] > -32; \ } \ $e{fg} = sprintf("rgb:%02x/%02x/%02x", @a[0 .. 2]); \ $e{bg} = sprintf("rgb:%02x/%02x/%02x", @b[0 .. 2]); \ $e{fs} = sprintf("rgb:%02x/%02x/%02x", @c[0 .. 2]); \ command("Colorset 21 fg $e{fg}, bg $e{bg}"); \ sleep(3); \ command("Colorset 21 fg $e{fg}, bg $e{bg}, fgsh $e{fs}"); \ sleep(3); \ } You may use system("xmessage 'fg $e{fg}, bg $e{bg}, fgsh $e{fs}'") instead of sleep(3) if you want to see numbers too. This algorithm is not perfect at all, but it produces good results. Regards, Mikhael. -- Visit the official FVWM web page at <URL:http://www.fvwm.org/>. To unsubscribe from the list, send "unsubscribe fvwm-workers" in the body of a message to [EMAIL PROTECTED] To report problems, send mail to [EMAIL PROTECTED]