css-overview: Fix+Explain color expr number ranges

Last try, promise. They don’t all use 0 to 1. We should probably explain
the effects too. Hopefully this manages that while not being too verbose
This commit is contained in:
Daniel Boles 2017-03-18 01:13:42 +00:00
parent 76eb8e3e98
commit b73e6ffbd8

View File

@ -584,12 +584,16 @@ background-color: @bg_color;
<para>
GTK+ also supports color expressions, which allow colors to be transformed
to new ones and can be nested, providing a rich language to define colors.
Color expressions resemble functions, taking 1 or more colors and in some
cases a number as arguments.
</para>
<para>
Color expressions resemble functions, taking 1 or more colors and in some
cases a number as their arguments. The number is floating-point, clamped
between 0 and 1, and specifies the degree to which the expression will
transform the given color(s) in the manner that is indicated by its name.
shade() leaves the color unchanged when the number is 1 and transforms it
to black or white as the number approaches 0 or 2 respectively. For mix(),
0 or 1 return the unaltered 1st or 2nd color respectively; numbers between
0 and 1 return blends of the two; and numbers below 0 or above 1 intensify
the RGB components of the 1st or 2nd colour respectively. alpha() takes a
number from 0 to 1 and applies that as the opacity of the supplied color.
</para>
<literallayout><code>〈color expression〉 = lighter(〈color〉) | darker(〈color〉) | shade(〈color〉,〈number〉) | alpha(〈color〉,〈number〉) | mix(〈color〉,〈color〉,〈number〉)</code>