libcosmic/cosmic/cosmic_theme/palette/chromatic_adaptation/index.html
2026-04-18 20:11:25 +00:00

23 lines
No EOL
6.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Convert colors from one reference white point to another"><title>cosmic::cosmic_theme::palette::chromatic_adaptation - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module chromatic_<wbr>adaptation</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cosmic_<wbr>theme::<wbr>palette</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../index.html">cosmic</a>::<wbr><a href="../../index.html">cosmic_theme</a>::<wbr><a href="../index.html">palette</a></div><h1>Module <span>chromatic_adaptation</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://docs.rs/palette/0.7.6/src/palette/lib.rs.html#349">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Convert colors from one reference white point to another</p>
<p>Chromatic adaptation is the human visual systems ability to adjust to
changes in illumination in order to preserve the appearance of object
colors. It is responsible for the stable appearance of object colours
despite the wide variation of light which might be reflected from an object
and observed by our eyes.</p>
<p>This library provides three methods for chromatic adaptation Bradford (which
is the default), VonKries and XyzScaling</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>palette::Xyz;
<span class="kw">use </span>palette::white_point::{A, C};
<span class="kw">use </span>palette::chromatic_adaptation::AdaptInto;
<span class="kw">let </span>a = Xyz::&lt;A, f32&gt;::new(<span class="number">0.315756</span>, <span class="number">0.162732</span>, <span class="number">0.015905</span>);
<span class="comment">//Will convert Xyz&lt;A, f32&gt; to Xyz&lt;C, f32&gt; using Bradford chromatic adaptation
</span><span class="kw">let </span>c: Xyz&lt;C, f32&gt; = a.adapt_into();
<span class="comment">//Should print {x: 0.257963, y: 0.139776,z: 0.058825}
</span><span class="macro">println!</span>(<span class="string">"{:?}"</span>, c)</code></pre></div>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.ConeResponseMatrices.html" title="struct cosmic::cosmic_theme::palette::chromatic_adaptation::ConeResponseMatrices">Cone<wbr>Response<wbr>Matrices</a></dt><dd>Holds the matrix coefficients for the chromatic adaptation methods</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Method.html" title="enum cosmic::cosmic_theme::palette::chromatic_adaptation::Method">Method</a></dt><dd>Chromatic adaptation methods implemented in the library</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.AdaptFrom.html" title="trait cosmic::cosmic_theme::palette::chromatic_adaptation::AdaptFrom">Adapt<wbr>From</a></dt><dd>Trait to convert color from one reference white point to another</dd><dt><a class="trait" href="trait.AdaptInto.html" title="trait cosmic::cosmic_theme::palette::chromatic_adaptation::AdaptInto">Adapt<wbr>Into</a></dt><dd>Trait to convert color with one reference white point into another</dd><dt><a class="trait" href="trait.TransformMatrix.html" title="trait cosmic::cosmic_theme::palette::chromatic_adaptation::TransformMatrix">Transform<wbr>Matrix</a></dt><dd>Generates a conversion matrix to convert the Xyz tristimulus values from
one illuminant to another (<code>source_wp</code> to <code>destination_wp</code>)</dd></dl></section></div></main></body></html>