Algosim documentation: FadeToColor

FadeToColor

Returns a colour or pixmap partially faded into a specific colour.

Syntax

Description

If c is a colour, then FadeToColor(c, ξ, t) returns the colour a fraction t on the way from c to ξ in terms of RGB coordinates. Specifically, if c = rgb(r, g, b) and ξ = rgb(ρ, γ, β), then

FadeToColor(c, ξ, t) =
  rgb(
    (1 − t)⋅r + t⋅ρ,
    (1 − t)⋅g + t⋅γ,
    (1 − t)⋅b + t⋅β
  ).

If pm is a pixmap, then FadeToColor(pm, ξ, t) returns the pixmap obtained from pm by transforming each of its pixels in this way.

If omitted, t defaults to .5.

Examples

FadeToColor(ExampleData("harvestman"), "gold")

Image 1

See also