Parent document is top of "Motif FAQ (Part 9 of 9)"
Previous document is "314) How do I get correct shadow colors to match other color"
Next document is "316) How can you access the superclass widget from which Motif"

315) What color algorithm does Motif use? I am told that Motif uses

some sort of algorithm that will take a single color that is defined for the
"background" and scale it so that the widget remains discriminable from the
background, etc.  What is the algorithm?

[Last modified: Oct 94]

Answer:  Chris Flatters (cflatter@nrao.edu) writes:  Shiz Kobara's book
"Visual Design with OSF/Motif", Addison Wesley,  1991, ISBN 0-201-56320-7) is
a good source for information of this sort.  I haven't seen it in bookshops
for a while so it may have gone out of print (which would be a pity).  In
essence each widget has 4 colours which, to first order, are

        background
        select          (background * 85%)
        top shadow      (background * 150%)
        bottom shadow   (background * 50%)

An additional correction may be applied to the hues of the calculated colours
if any of the RGB values saturates.  The algorithm works best if the brightest
of the RGB components lies in the range 155-175 (on a scale of 0-255).  The
top shadow becomes darker than the background for light background colours
which does not lead to a particularly pleasing effect.

Parent document is top of "Motif FAQ (Part 9 of 9)"
Previous document is "314) How do I get correct shadow colors to match other color"
Next document is "316) How can you access the superclass widget from which Motif"