Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | pixel_robot: Added OKLAB/OKLCH to documentation. | 
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive | 
| Timelines: | family | ancestors | descendants | both | trunk | 
| Files: | files | file ages | folders | 
| SHA3-256: | c18fdb3fc679dbc2ae529b254b781e62 | 
| User & Date: | andy 2025-05-01 23:38:26 | 
Context
| 2025-05-01 | ||
| 23:38 | pixel_robot: TODO updates. check-in: 0ce6395ea5 user: andy tags: trunk | |
| 23:38 | pixel_robot: Added OKLAB/OKLCH to documentation. check-in: c18fdb3fc6 user: andy tags: trunk | |
| 23:37 | pixel_robot: Handle OKLCH color mixing. check-in: 7808fe33aa user: andy tags: trunk | |
Changes
Changes to pixel_robot/doc/tex/app-color-spaces.tex.
| ︙ | ︙ | |||
| 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 
appear identical. The only color spaces which produce \emph{different} 
interpolations are
\begin{itemize}
  \item RGB: because the interpolation is done in sRGB, not linear RGB.
  \item LAB: because LAB is a \emph{non-linear} transformation of XYZ.
  \item HSL/HSV: Because HSL/HSV are cylindrical/conical color spaces, using
  polar coordinates.
\end{itemize}
The same is true for color similarity (i.e., \texttt{color.dist()}): because
\texttt{xyz}, \texttt{yuv}, etc. are all linear transformations (matrix 
multiplications) of each other, their similarities will all be consistent.
\hypertarget{app-color-space-xyz}{%
 | > > > > > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 
appear identical. The only color spaces which produce \emph{different} 
interpolations are
\begin{itemize}
  \item RGB: because the interpolation is done in sRGB, not linear RGB.
  \item LAB: because LAB is a \emph{non-linear} transformation of XYZ.
  \item HSL/HSV: Because HSL/HSV are cylindrical/conical color spaces, using
  polar coordinates.
  \item OKLAB: Because, like LAB, it's a non-linear transformation of 
  XYZ.
  \item OKLCH: Because, like HSL/HSV, it's a cylindrical/conical color
  space that is \emph{also} derived from a non-linear transformation
  of XYZ (i.e., derived from OKLAB).
\end{itemize}
The same is true for color similarity (i.e., \texttt{color.dist()}): because
\texttt{xyz}, \texttt{yuv}, etc. are all linear transformations (matrix 
multiplications) of each other, their similarities will all be consistent.
\hypertarget{app-color-space-xyz}{%
 | 
| ︙ | ︙ | |||
| 87 88 89 90 91 92 93 | 
\hypertarget{app-color-space-hsv}{%
\section{HSV}\label{aapp-color-space-hsv}}
\hypertarget{app-color-space-hsl}{%
\section{HSL}\label{aapp-color-space-hsl}}
 | > > > > > | 92 93 94 95 96 97 98 99 100 101 102 103 | 
\hypertarget{app-color-space-hsv}{%
\section{HSV}\label{aapp-color-space-hsv}}
\hypertarget{app-color-space-hsl}{%
\section{HSL}\label{aapp-color-space-hsl}}
\hypertarget{app-color-space-oklab}{%
\section{OKLAB}\label{aapp-color-space-oklab}}
\hypertarget{app-color-space-oklch}{%
\section{OKLCH}\label{aapp-color-space-oklch}}
 | 
Changes to pixel_robot/doc/tex/palettes.tex.
| ︙ | ︙ | |||
| 154 155 156 157 158 159 160 | 
\begin{prCode}
color.from('hsv', 180, 0.5, 0.5 );
color.from('yuv', 0.2, 0.5, 0.6 );
\end{prCode}
PR understands the color spaces \texttt{rgb} (\texttt{rgba} is an
alias), \texttt{hsv}, \texttt{hsl}, \texttt{xyz}, \texttt{lab},
 | | > | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | 
\begin{prCode}
color.from('hsv', 180, 0.5, 0.5 );
color.from('yuv', 0.2, 0.5, 0.6 );
\end{prCode}
PR understands the color spaces \texttt{rgb} (\texttt{rgba} is an
alias), \texttt{hsv}, \texttt{hsl}, \texttt{xyz}, \texttt{lab},
\texttt{yuv}, and \texttt{yiq}, \texttt{ypbpr}, \texxtt{OKLAB} and 
\texttt{OKLCH} (the ``angular hue'' form of \texttt{OKLAB}). 
\texttt{from()} always returns colors with an alpha of 255. 
You can convert a sRGB color \emph{into} another color space, via 
\texttt{color.to}:
\begin{prCode}[emph={hue,sat,val}]
color.to('hsv', color`red`)  --->   [hue, sat, val]
\end{prCode}
 | 
| ︙ | ︙ | |||
| 402 403 404 405 406 407 408 | 
pal.sort('order');
\end{prCode}
The sort order is optional and defaults to \texttt{"natural"}. The sort
order can be a comma-separated list of color components, e.g.,
\texttt{"r,g,b"} to mean, sort first by red, then by green, then by
blue. The color components must all come from the same color space, and
 | | < | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | 
pal.sort('order');
\end{prCode}
The sort order is optional and defaults to \texttt{"natural"}. The sort
order can be a comma-separated list of color components, e.g.,
\texttt{"r,g,b"} to mean, sort first by red, then by green, then by
blue. The color components must all come from the same color space, and
must match one of the color spaces PR knows about (RGB, HSV, HSL, etc.).
Alternatively, the sort order can be \texttt{"natural"} or
\texttt{"hilbert"}.
\begin{itemize}
\item
  In the \emph{natural} sort order, PR sorts the colors by Hue +
 | 
| ︙ | ︙ | 
Changes to pixel_robot/doc/tex/reference.tex.
| ︙ | ︙ | |||
| 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | 
\texttt{xyz}     & CIE 1931 XYZ space               \\
\texttt{lab}     & CIELAB space, derived from XYZ (with D64 illuminant)  \\
\texttt{yib}     & YIB space, used by NTSC analog televisions \\
\texttt{yuv}     & YUV space, used by PAL analog televisions \\
\texttt{ypbpr}   & YPbPr space \\
\texttt{hsv}     & Hue-Saturation-Value space \\
\texttt{hsl}     & Hue-Saturation-Luma space \\
\bottomrule
\end{tabulary}
See appendix \ref{app-color-space-definitions} for the full conversions 
to/from these color spaces.
Note that in \texttt{rgb} space, all components are integers in the range from 
 | > > | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | 
\texttt{xyz}     & CIE 1931 XYZ space               \\
\texttt{lab}     & CIELAB space, derived from XYZ (with D64 illuminant)  \\
\texttt{yib}     & YIB space, used by NTSC analog televisions \\
\texttt{yuv}     & YUV space, used by PAL analog televisions \\
\texttt{ypbpr}   & YPbPr space \\
\texttt{hsv}     & Hue-Saturation-Value space \\
\texttt{hsl}     & Hue-Saturation-Luma space \\
\texttt{oklab}   & OKLAB space \\
\texttt{oklch}   & OKLCH space, the ``polar form'' of OKLAB \\
\bottomrule
\end{tabulary}
See appendix \ref{app-color-space-definitions} for the full conversions 
to/from these color spaces.
Note that in \texttt{rgb} space, all components are integers in the range from 
 | 
| ︙ | ︙ |