Skip to content

Color series using method last never cycle #9

@muzimuzhi

Description

@muzimuzhi

The name of \colorseriescycle and the phrase vector \emph{last} used in the doc for color series may make users misunderstand that such a series cycle.

In the following example, user may expect foo!![4] == base == {.3,.3,.3}, but actually it's {.6,.6,.6}

\documentclass{article}
\usepackage{xcolor}

\begin{document}
\definecolorseries{foo}{rgb}{last}[rgb]{.3,.3,.3}[rgb]{.5,.5,.5}
\resetcolorseries[2]{foo} % step = .1,.1,.1

\ttfamily
\begin{testcolors}[rgb]
  \testcolor{foo!![0]}
  \testcolor{foo!![1]}
  \testcolor{foo!![2]}
  \testcolor{foo!![3]}
\end{testcolors}
\end{document}

image

The relevant doc indicates this is the expected behavior, not a bug.

xcolor/xcolor.dtx

Lines 1267 to 1281 in 1924d5a

% This is the general scheme:
% \begin{gather}
% \emph{color}_1 := \emph{base},\qquad
% \emph{color}_{n+1} := U\bigl(\emph{color}_{n} + \emph{step}\bigr)
% \end{gather}
% for $n=1,2,\dots$, where $U$ maps arbitrary real $m$-vectors into the unit $m$-cube:
% \begin{gather}
% U(x_1,\dots,x_m) = (u(x_1),\dots,u(x_m)),\qquad
% u(x) =
% \begin{cases}
% 1 & \text{if $x=1$}\\
% x-[x]& \text{if $x\neq1$}\\
% \end{cases}\label{eq.U}
% \end{gather}
% Thus, every step of the algorithm yields a valid color with parameters from the interval $[0,1]$.

Perhaps xcolor could add some words to the doc?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions