diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-08-07 15:02:50 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-08-07 15:58:16 +0200 |
| commit | 07c80e9a815750079b9a091fdc434ec498bc4cd0 (patch) | |
| tree | f0ccb4472e1f6491212bf39509a5f947bfdeb5ef /crates/typst-library/src/compute/construct.rs | |
| parent | 800744ed9d3923eecf3436f2029e77033e8f1b6a (diff) | |
Touch up docs
Diffstat (limited to 'crates/typst-library/src/compute/construct.rs')
| -rw-r--r-- | crates/typst-library/src/compute/construct.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/crates/typst-library/src/compute/construct.rs b/crates/typst-library/src/compute/construct.rs index 841bf406..0a6f24a5 100644 --- a/crates/typst-library/src/compute/construct.rs +++ b/crates/typst-library/src/compute/construct.rs @@ -345,7 +345,7 @@ pub fn datetime_today( /// #square( /// fill: cmyk(27%, 0%, 3%, 5%) /// ) -/// ```` +/// ``` /// /// Display: CMYK /// Category: construct @@ -384,13 +384,14 @@ pub fn color_module() -> Module { /// Create a color by mixing two or more colors. /// -/// ## Example +/// ## Example { #example } /// ```example -/// #color.mix(red, green) -/// #color.mix(red, green, white) -/// #color.mix(red, green, space: "srgb") -/// #color.mix((red, 30%), (green, 70%)) -/// ```` +/// #set block(height: 20pt, width: 100%) +/// #block(fill: color.mix(red, blue)) +/// #block(fill: color.mix(red, blue, space: "srgb")) +/// #block(fill: color.mix((red, 70%), (blue, 30%))) +/// #block(fill: color.mix(red, blue, white)) +/// ``` /// /// _Note:_ This function must be specified as `color.mix`, not just `mix`. /// Currently, `color` is a module, but it is designed to be forward compatible @@ -402,6 +403,9 @@ pub fn color_module() -> Module { pub fn mix( /// The colors, optionally with weights, specified as a pair (array of /// length two) of color and weight (float or ratio). + /// + /// The weights do not need to add to `{100%}`, they are relative to the + /// sum of all weights. #[variadic] colors: Vec<WeightedColor>, /// The color space to mix in. By default, this happens in a perceptual |
