[latex3-commits] [latex3/graphics-def] XC-color: first pass making color back end match xcolor (021b9c4)

github at latex-project.org github at latex-project.org
Sat Dec 9 20:36:49 CET 2023


Repository : https://github.com/latex3/graphics-def
On branch  : XC-color
Link       : https://github.com/latex3/graphics-def/commit/021b9c42e21b19167a99ead2b9c5e22d13380af1

>---------------------------------------------------------------

commit 021b9c42e21b19167a99ead2b9c5e22d13380af1
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sat Dec 9 19:36:49 2023 +0000

    first pass making color back end match xcolor


>---------------------------------------------------------------

021b9c42e21b19167a99ead2b9c5e22d13380af1
 pdftex.def          | 13 ++++++++-----
 testfiles/xc001.lvt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 testfiles/xc001.tlg |  6 ++++++
 3 files changed, 62 insertions(+), 5 deletions(-)

diff --git a/pdftex.def b/pdftex.def
index 35eb376..3f4c413 100644
--- a/pdftex.def
+++ b/pdftex.def
@@ -3,7 +3,7 @@
 %%                         Hans Hagen, Heiko Oberdiek and
 %%                         Martin Schr\"oder
 %% Copyright (C) 2016-2018 LaTeX3 project and Heiko Oberdiek
-%% Copyright (C) 2018-2022 LaTeX3 project
+%% Copyright (C) 2018-2023 LaTeX3 project
 %%
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3c
@@ -20,8 +20,11 @@
 %% https://github.com/latex3/graphics-def/issues
 %%
 \ProvidesFile{pdftex.def}
-  [2022/09/22 v1.2b Graphics/color driver for pdftex]
+  [2023/12/09 v1.3a Graphics/color driver for pdftex]
 \def\GPT at space{ }
+\providecommand\xcolor@[4]{#2}
+\def\GPT at xcolor@{\ifx\colorlet\@undefined\noexpand\xcolor@\else\expandafter\xcolor@\fi}
+
 \def\c at lor@arg#1{%
   \dimen@#1\p@
   \ifdim\dimen@<\z@\dimen@\maxdimen\fi
@@ -30,7 +33,7 @@
   \fi}
 \def\color at gray#1#2{%
   \c at lor@arg{#2}%
-  \edef#1{#2 g #2 G}%
+  \edef#1{\GPT at xcolor@{}{#2 g #2 G}{\detokenize{gray}}{#2}}%
   }
 \def\color at cmyk#1#2{\c at lor@@cmyk#2\@@#1}
 \def\c at lor@@cmyk#1,#2,#3,#4\@@#5{%
@@ -38,14 +41,14 @@
   \c at lor@arg{#1}%
   \c at lor@arg{#2}%
   \c at lor@arg{#3}%
-  \edef#5{#1 #2 #3 #4 k #1 #2 #3 #4 K}%
+  \edef#5{\GPT at xcolor@{}{#1 #2 #3 #4 k #1 #2 #3 #4 K}{\detokenize{cmyk}}{#1,#2,#3,#4}}%
   }
 \def\color at rgb#1#2{\c at lor@@rgb#2\@@#1}
 \def\c at lor@@rgb#1,#2,#3\@@#4{%
   \c at lor@arg{#1}%
   \c at lor@arg{#2}%
   \c at lor@arg{#3}%
-  \edef#4{#1 #2 #3 rg #1 #2 #3 RG}%
+  \edef#4{\GPT at xcolor@{}{#1 #2 #3 rg #1 #2 #3 RG}{\detokenize{rgb}}{#1,#2,#3}}%
   }
 \def\color at RGB#1#2{\c at lor@@RGB#2\@@#1}
 \def\c at lor@@RGB#1,#2,#3\@@#4{%
diff --git a/testfiles/xc001.lvt b/testfiles/xc001.lvt
new file mode 100755
index 0000000..a88f449
--- /dev/null
+++ b/testfiles/xc001.lvt
@@ -0,0 +1,48 @@
+\documentclass{article}
+\input{regression-test}
+
+\usepackage[dvipsnames]{color}
+
+
+
+\definecolor{crgb}{rgb}{0,0.5,0}
+\definecolor{cRGB}{RGB}{0,128,0}
+\definecolor{ccmyk}{cmyk}{0,0.5,0.7,0.1}
+\definecolor{cgray}{gray}{0.8}
+\definecolor{cnamed}{named}{Peach}
+
+\usepackage[dvipsnames]{xcolor}
+
+
+\definecolor{xcrgb}{rgb}{0,0.5,0}
+\definecolor{xcRGB}{RGB}{0,128,0}
+\definecolor{xccmyk}{cmyk}{0,0.5,0.7,0.1}
+\definecolor{xcgray}{gray}{0.8}
+\definecolor{xcnamed}{named}{Peach}
+
+\START
+\ExplSyntaxOn
+\cs_generate_variant:Nn \tl_analysis_show:N {c}
+
+\def\test#1{%
+\expandafter\ifx
+\csname\string\color @c#1\expandafter\endcsname
+\csname\string\color @xc#1\endcsname
+\typeout{^^JPASS:~ #1}
+\else
+\typeout{^^JFAIL:~ #1}
+\typeout{~c:~ \expandafter\meaning\csname\string\color @c#1\endcsname}
+\typeout{xc:~ \expandafter\meaning\csname\string\color @xc#1\endcsname}
+\tl_analysis_show:c{\string\color @c#1}
+\tl_analysis_show:c{\string\color @xc#1}
+\fi
+}
+\ExplSyntaxOff
+
+\test{rgb}
+\test{RGB}
+\test{cmyk}
+\test{gray}
+%\test{named}
+
+\END
\ No newline at end of file
diff --git a/testfiles/xc001.tlg b/testfiles/xc001.tlg
new file mode 100644
index 0000000..61dfb4f
--- /dev/null
+++ b/testfiles/xc001.tlg
@@ -0,0 +1,6 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+PASS: rgb
+PASS: RGB
+PASS: cmyk
+PASS: gray





More information about the latex3-commits mailing list.