mirror of
https://github.com/typst/typst
synced 2025-05-18 11:05:28 +08:00
Fix color documentation (#3688)
This commit is contained in:
parent
b279b9d214
commit
babe44c5d6
@ -117,13 +117,12 @@ static TO_SRGB: Lazy<qcms::Transform> = Lazy::new(|| {
|
|||||||
/// columns: 9,
|
/// columns: 9,
|
||||||
/// gutter: 10pt,
|
/// gutter: 10pt,
|
||||||
/// ..colors.map(name => {
|
/// ..colors.map(name => {
|
||||||
/// let c = eval(name)
|
/// let col = eval(name)
|
||||||
/// let cp = c.components()
|
/// let luminance = luma(col).components().first()
|
||||||
/// let x = cp.sum() / cp.len()
|
/// set text(fill: white) if luminance < 50%
|
||||||
/// set text(fill: white) if x < 50%
|
/// set square(stroke: black) if col == white
|
||||||
/// set square(stroke: black) if c == white
|
|
||||||
/// set align(center + horizon)
|
/// set align(center + horizon)
|
||||||
/// square(size: 50pt, fill: c, name)
|
/// square(size: 50pt, fill: col, name)
|
||||||
/// })
|
/// })
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
@ -736,7 +735,7 @@ impl Color {
|
|||||||
///
|
///
|
||||||
/// ```example
|
/// ```example
|
||||||
/// // note that the alpha component is included by default
|
/// // note that the alpha component is included by default
|
||||||
/// #(rgb(40%, 60%, 80%).components() == (40%, 60%, 80%, 100%))
|
/// #rgb(40%, 60%, 80%).components()
|
||||||
/// ```
|
/// ```
|
||||||
#[func]
|
#[func]
|
||||||
pub fn components(
|
pub fn components(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user