[latex3-commits] [l3svn] branch master updated: Set current colour based on color package data

noreply at latex-project.org noreply at latex-project.org
Tue Apr 5 15:26:44 CEST 2016


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

The following commit(s) were added to refs/heads/master by this push:
       new  8ad7744   Set current colour based on color package data
8ad7744 is described below

commit 8ad774448bf9f3a180e9731866b6e8cf86553daf
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Apr 5 14:26:17 2016 +0100

    Set current colour based on color package data
---
 build-config.lua                    |    1 +
 l3kernel/l3drivers.dtx              |   13 ++-
 l3kernel/testfiles/m3coffins002.lvt |   36 +++++++
 l3kernel/testfiles/m3coffins002.tlg |   33 ++++++
 support/color.sty                   |  194 +++++++++++++++++++++++++++++++++++
 5 files changed, 275 insertions(+), 2 deletions(-)

diff --git a/build-config.lua b/build-config.lua
index 5cb0ca2..33ef879 100644
--- a/build-config.lua
+++ b/build-config.lua
@@ -10,6 +10,7 @@ checkengines    = checkengines
 checksuppfiles  = checksuppfiles  or
   {
     "CaseFolding.txt",
+    "color.sty",
     "minimal.cls",
     "regression-test.cfg",
     "SpecialCasing.txt",
diff --git a/l3kernel/l3drivers.dtx b/l3kernel/l3drivers.dtx
index 43c4648..b55659c 100644
--- a/l3kernel/l3drivers.dtx
+++ b/l3kernel/l3drivers.dtx
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-%% File: l3drivers.dtx Copyright(C) 2011-2015 The LaTeX3 Project
+%% File: l3drivers.dtx Copyright(C) 2011-2016 The LaTeX3 Project
 %%
 %% It may be distributed and/or modified under the conditions of the
 %% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -498,7 +498,8 @@
 %
 % \begin{variable}{\l_@@_current_color_tl}
 %   The current color is needed by all of the engines, but the way this
-%   is stored varies.
+%   is stored varies. In package mode if the \pkg{color} package is loaded
+%   simply pick up what it is using.
 %    \begin{macrocode}
 \tl_new:N \l_@@_current_color_tl
 %<*dvipdfmx|dvips|xdvipdfmx>
@@ -507,6 +508,14 @@
 %<*pdfmode>
 \tl_set:Nn \l_@@_current_color_tl { 0~g~0~G }
 %</pdfmode>
+%<*package>
+\AtBeginDocument
+  {
+    \@ifpackageloaded { color }
+      { \tl_set:Nn \l_@@_current_color_tl { \current at color } }
+      { }
+  }
+%</package>
 %    \end{macrocode}
 % \end{variable}
 %
diff --git a/l3kernel/testfiles/m3coffins002.lvt b/l3kernel/testfiles/m3coffins002.lvt
new file mode 100644
index 0000000..c656674
--- /dev/null
+++ b/l3kernel/testfiles/m3coffins002.lvt
@@ -0,0 +1,36 @@
+%
+% Copyright (C) 2016 The LaTeX3 Project
+%
+
+\documentclass{minimal}
+\input{regression-test}
+
+\RequirePackage[check-declarations,log-functions]{expl3}
+\RequirePackage{color}
+
+\begin{document}
+
+\START
+\AUTHOR{Joseph Wright}
+
+\ExplSyntaxOn
+
+\showoutput
+
+\hcoffin_set:Nn \l_tmpa_coffin { Hello }
+
+\color { red }
+
+\hcoffin_set:Nn \l_tmpb_coffin { world }
+
+\coffin_typeset:Nnnnn \l_tmpa_coffin { l } { T } { 0pt } { 0pt }
+
+\coffin_typeset:Nnnnn \l_tmpb_coffin { l } { T } { 0pt } { 0pt }
+
+\color { black }
+
+\coffin_typeset:Nnnnn \l_tmpa_coffin { l } { T } { 0pt } { 0pt }
+
+\coffin_typeset:Nnnnn \l_tmpb_coffin { l } { T } { 0pt } { 0pt }
+
+\END
diff --git a/l3kernel/testfiles/m3coffins002.tlg b/l3kernel/testfiles/m3coffins002.tlg
new file mode 100644
index 0000000..e6764f9
--- /dev/null
+++ b/l3kernel/testfiles/m3coffins002.tlg
@@ -0,0 +1,33 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Joseph Wright
+! Undefined control sequence.
+\l__driver_current_color_tl ->\current at color 
+l. ...\hcoffin_set:Nn \l_tmpa_coffin { Hello }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! LaTeX Error: Undefined color `red'.
+See the LaTeX manual or LaTeX Companion for explanation.
+Type  H <return>  for immediate help.
+ ...                                              
+l. ...\color { red }
+You're in trouble here.  Try typing  <return>  to proceed.
+If that doesn't work, type  X <return>  to quit.
+! Undefined control sequence.
+\l__driver_current_color_tl ->\current at color 
+l. ...\hcoffin_set:Nn \l_tmpb_coffin { world }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! LaTeX Error: Undefined color `black'.
+See the LaTeX manual or LaTeX Companion for explanation.
+Type  H <return>  for immediate help.
+ ...                                              
+l. ...\color { black }
+You're in trouble here.  Try typing  <return>  to proceed.
+If that doesn't work, type  X <return>  to quit.
diff --git a/support/color.sty b/support/color.sty
new file mode 100644
index 0000000..a354fea
--- /dev/null
+++ b/support/color.sty
@@ -0,0 +1,194 @@
+%%
+%% This is file `color.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% color.dtx  (with options: `package')
+%% 
+%% The source is maintained by the LaTeX Project team and bug
+%% reports for it can be opened at http://latex-project.org/bugs.html
+%% (but please observe conditions on bug reports sent to that address!)
+%% 
+%% 
+%% color.dtx Copyright (C) 1994--1999 David Carlisle
+%%           Copyright (C) 2005--2015 David Carlisle, LaTeX3 Project
+%%
+%% This file is part of the Standard LaTeX `Graphics Bundle'.
+%% It may be distributed under the terms of the LaTeX Project Public
+%% License, as described in lppl.txt in the base LaTeX distribution.
+%% Either version 1.3c or, at your option, any later version.
+%%
+%% This file has the LPPL maintenance status "maintained".
+%%
+\NeedsTeXFormat{LaTeX2e}[1995/12/01]
+\ProvidesPackage{color}
+          [2016/01/03 v1.1b Standard LaTeX Color (DPC)]
+\edef\Gin at codes{%
+ \catcode`\noexpand\^^A\the\catcode`\^^A\relax
+ \catcode`\noexpand\"\the\catcode`\"\relax
+ \catcode`\noexpand\*\the\catcode`\*\relax
+ \catcode`\noexpand\!\the\catcode`\!\relax
+ \catcode`\noexpand\:\the\catcode`\:\relax}
+\catcode`\^^A=\catcode`\%
+\catcode`\"=12
+\catcode`\*=11
+\catcode`\!=12
+\catcode`\:=12
+\providecommand\Gin at driver{}
+\def\c at lor@error#1{%
+  \@latex at error{Undefined color #1}\@ehd}
+\DeclareOption{monochrome}{%
+  \def\c at lor@error#1{\PackageInfo{color}{Undefined color #1}}%
+  \AtEndOfPackage{%
+    \colors at false
+    \def\set at color{%
+      \c at lor@special\m at ne
+        {color push \current at color}\aftergroup\reset at color}%
+    \def\reset at color{\c at lor@special\m at ne{color pop}}%
+    \def\set at page@color{%
+      \c at lor@special\m at ne{background \current at color}}%
+    \def\define at color#1#2{%
+      \c at lor@special\m at ne{define #1 #2}}}}
+\DeclareOption{debugshow}{\catcode`\^^A=9 \let\GDebug\typeout}
+\DeclareOption{dvips}{\def\Gin at driver{dvips.def}%
+                      \def\c at lor@namefile{dvipsnam.def}}
+\DeclareOption{xdvi}{\ExecuteOptions{dvips,monochrome}}
+\DeclareOption{dvipdf}{\def\Gin at driver{dvipdf.def}}
+\DeclareOption{dvipdfm}{\def\Gin at driver{dvipdfm.def}}
+\DeclareOption{dvipdfmx}{\def\Gin at driver{dvipdfmx.def}}
+\DeclareOption{pdftex}{\def\Gin at driver{pdftex.def}}
+\DeclareOption{luatex}{\def\Gin at driver{luatex.def}}
+\DeclareOption{xetex}{\def\Gin at driver{xetex.def}}
+\DeclareOption{dvipsone}{\def\Gin at driver{dvipsone.def}}
+\DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}}
+\DeclareOption{emtex}{\def\Gin at driver{emtex.def}}
+\DeclareOption{dviwin}{\def\Gin at driver{dviwin.def}}
+\DeclareOption{oztex}{\ExecuteOptions{dvips}}
+\DeclareOption{textures}{\def\Gin at driver{textures.def}}
+\DeclareOption{pctexps}{\def\Gin at driver{pctexps.def}}
+\DeclareOption{pctexwin}{\def\Gin at driver{pctexwin.def}}
+\DeclareOption{pctexhp}{\def\Gin at driver{pctexhp.def}}
+\DeclareOption{pctex32}{\def\Gin at driver{pctex32.def}}
+\DeclareOption{truetex}{\def\Gin at driver{truetex.def}}
+\DeclareOption{tcidvi}{\def\Gin at driver{tcidvi.def}}
+\DeclareOption{vtex}{\def\Gin at driver{vtex.def}}
+\DeclareOption{dvipsnames}{\def\c at lor@namefile{dvipsnam.def}}
+\DeclareOption{nodvipsnames}{\let\c at lor@namefile\relax}
+\let\c at lor@usename\@gobble
+\DeclareOption{usenames}{%
+  \def\c at lor@usename#1{%
+    \expandafter\color at named\csname\string\color @#1\endcsname{#1}}}
+\DeclareRobustCommand\color{%
+  \@ifnextchar[\@undeclaredcolor\@declaredcolor}
+\def\@undeclaredcolor[#1]#2{%
+  \@ifundefined{color@#1}%
+    {\c at lor@error{model `#1'}}%
+    {\csname color@#1\endcsname\current at color{#2}%
+     \set at color}%
+  \ignorespaces}
+\def\@declaredcolor#1{%
+  \@ifundefined{\string\color @#1}%
+    {\c at lor@error{`#1'}}%
+    {\expandafter\let\expandafter\current at color
+     \csname\string\color @#1\endcsname
+     \set at color}%
+  \ignorespaces}
+\def\textcolor#1#{\@textcolor{#1}}
+\def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}}
+\def\pagecolor{%
+  \begingroup
+      \let\ignorespaces\endgroup
+      \let\set at color\set at page@color
+      \color}
+\def\nopagecolor{%
+  \@ifundefined{no at page@color}{%
+    \PackageInfo{color}{\string\nopagecolor\space is not supported}%
+  }{%
+    \no at page@color
+  }%
+}
+\def\definecolor#1#2#3{%
+  \@ifundefined{color@#2}%
+    {\c at lor@error{model `#2'}}%
+    {\@ifundefined{\string\color @#1}{}%
+      {\PackageInfo{color}{Redefining color #1}}%
+     \csname color@#2\expandafter\endcsname
+         \csname\string\color @#1\endcsname{#3}}}
+\def\DefineNamedColor#1#2#3#4{%
+  \@ifundefined{define at color@#1}%
+    {\c at lor@error{model `#1'}}%
+    {\@ifundefined{color@#3}%
+      {\c at lor@error{model `#3'}}%
+      {\@ifundefined{c at lor@#1@#2}{}%
+        {\PackageInfo{color}{Redefining color #2 in named color model}}%
+      \csname color@#3\endcsname\@tempa{#4}%
+      \csname define at color@#1\endcsname{#2}\@tempa
+      \c at lor@usename{#2}}}}
+\@onlypreamble\DefineNamedColor
+\newif\ifcolors@
+\colors at true
+\def\c at lor@special#1#2{%
+  \edef\@tempa{\write#1{#2}}\@tempa}
+\InputIfFileExists{color.cfg}{}{}
+\ProcessOptions
+\if!\Gin at driver!
+  \PackageError{color}
+    {No driver specified}
+    {You should make a default driver option in a file \MessageBreak
+     color.cfg\MessageBreak
+     eg: \protect\ExecuteOptions{dvips}%
+     }
+\else
+  \PackageInfo{color}{Driver file: \Gin at driver}
+  \@ifundefined{ver@\Gin at driver}{\input{\Gin at driver}}{}
+\fi
+\@ifundefined{c at lor@namefile}{}{\input{\c at lor@namefile}}
+\def\normalcolor{\let\current at color\default at color\set at color}
+\AtBeginDocument{\let\default at color\current at color}
+\def\color at block#1#2#3{%
+  {\set at color\rlap{\ifcolors@\vrule\@width#1\@height#2\@depth#3\fi}}}
+\def\colorbox#1#{\color at box{#1}}
+\def\color at box#1#2{\color at b@x\relax{\color#1{#2}}}
+\def\fcolorbox#1#{\color at fbox{#1}}
+\def\color at fbox#1#2#3{%
+  \color at b@x{\fboxsep\z@\color#1{#2}\fbox}{\color#1{#3}}}
+
+\long\def\color at b@x#1#2#3{%
+ \leavevmode
+ \setbox\z@\hbox{\kern\fboxsep{\set at color#3}\kern\fboxsep}%
+ \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@
+ \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@
+ {#1{#2\color at block{\wd\z@}{\ht\z@}{\dp\z@}%
+      \box\z@}}}
+\def\color at setgroup{\begingroup\set at color}
+\let\color at begingroup\begingroup
+\def\color at endgroup{\endgraf\endgroup}
+\def\color at hbox{\hbox\bgroup\color at begingroup}
+\def\color at vbox{\vbox\bgroup\color at begingroup}
+\def\color at endbox{\color at endgroup\egroup}
+\ifx\color at gray\@undefined
+  \ifx\color at rgb\@undefined
+  \else
+    \definecolor{black}{rgb}{0,0,0}
+    \definecolor{white}{rgb}{1,1,1}
+  \fi
+\else
+  \definecolor{black}{gray}{0}
+  \definecolor{white}{gray}{1}
+\fi
+\ifx\color at rgb\@undefined\else
+  \definecolor{red}{rgb}{1,0,0}
+  \definecolor{green}{rgb}{0,1,0}
+  \definecolor{blue}{rgb}{0,0,1}
+\fi
+\ifx\color at cmyk\@undefined\else
+  \definecolor{cyan}{cmyk}{1,0,0,0}
+  \definecolor{magenta}{cmyk}{0,1,0,0}
+  \definecolor{yellow}{cmyk}{0,0,1,0}
+\fi
+\Gin at codes
+\let\Gin at codes\relax
+\endinput
+%%
+%% End of file `color.sty'.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list