[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add support for "Gray" color model (c186279c5)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Aug 10 14:22:19 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/c186279c5da817555792a383c134df9ef0888aab

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

commit c186279c5da817555792a383c134df9ef0888aab
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Aug 10 13:22:19 2020 +0100

    Add support for "Gray" color model


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

c186279c5da817555792a383c134df9ef0888aab
 l3experimental/CHANGELOG.md                     |  1 +
 l3experimental/l3color/l3color.dtx              |  6 +++++-
 l3experimental/l3color/testfiles/m3color002.lvt |  8 ++++++++
 l3experimental/l3color/testfiles/m3color002.tlg | 24 +++++++++++++++++++-----
 4 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/l3experimental/CHANGELOG.md b/l3experimental/CHANGELOG.md
index 7ee9c5b0f..062521591 100644
--- a/l3experimental/CHANGELOG.md
+++ b/l3experimental/CHANGELOG.md
@@ -8,6 +8,7 @@ this project uses date-based 'snapshot' version identifiers.
 ## [Unreleased]
 
 ### Added
+- Support for `Gray` color model
 - Support for `hsb` color model
 
 ## [2020-08-07]
diff --git a/l3experimental/l3color/l3color.dtx b/l3experimental/l3color/l3color.dtx
index 9004dd38a..fc75e5f00 100644
--- a/l3experimental/l3color/l3color.dtx
+++ b/l3experimental/l3color/l3color.dtx
@@ -77,6 +77,8 @@
 % are primarily integer-based: see below for more detail. The supported
 % interface models are
 % \begin{itemize}
+%   \item \texttt{Gray} Grayscale color, with a single axis running from
+%     $0$ (fully black) to $15$ (fully white)
 %   \item \texttt{hsb} Hue-saturation-brightness color, with three axes,all 
 %     real values in the range $[0,1]$ for hue saturation and brightness
 %   \item \texttt{Hsb} Hue-saturation-brightness color, with three axes, integer
@@ -862,11 +864,13 @@
 %
 % \begin{macro}[EXP]
 %   {
-%     \@@_parse_model_hsb:w,
+%     \@@_parse_model_Gray:w, \@@_parse_model_hsb:w,
 %     \@@_parse_model_Hsb:w, \@@_parse_model_HSB:w,
 %     \@@_parse_model_HTML:w, \@@_parse_model_RGB:w
 %   }
 %    \begin{macrocode}
+\cs_new:Npn \@@_parse_model_Gray:w #1 , #2 \s_@@_stop
+  { { gray } { \fp_eval:n { #1 / 15 } } }
 \cs_new:Npn \@@_parse_model_hsb:w #1 , #2 , #3 , #4 \s_@@_stop
   { \@@_parse_model_hsb:nnn {#1} {#2} {#3} }
 \cs_new:Npn \@@_parse_model_Hsb:w #1 , #2 , #3 , #4 \s_@@_stop
diff --git a/l3experimental/l3color/testfiles/m3color002.lvt b/l3experimental/l3color/testfiles/m3color002.lvt
index 6d5fbb5c6..bbcacc624 100644
--- a/l3experimental/l3color/testfiles/m3color002.lvt
+++ b/l3experimental/l3color/testfiles/m3color002.lvt
@@ -18,6 +18,14 @@
 
 \ExplSyntaxOn
 
+\TEST { Gray~model }
+  {
+    \color_set:nnn { foo1 } { Gray } { 2 }
+    \color_show:n { foo1 }
+    \color_set:nnn { foo1 } { Gray } { 14 }
+    \color_show:n { foo1 }
+  }
+
 \TEST { hsb~model }
   {
     \color_set:nnn { foo1 } { hsb } { 0.11389 , 0.6 , 0.7 }
diff --git a/l3experimental/l3color/testfiles/m3color002.tlg b/l3experimental/l3color/testfiles/m3color002.tlg
index 098fea03f..efea2746e 100644
--- a/l3experimental/l3color/testfiles/m3color002.tlg
+++ b/l3experimental/l3color/testfiles/m3color002.tlg
@@ -2,11 +2,25 @@ This is a generated file for the LaTeX (2e + expl3) validation system.
 Don't change this file in any respect.
 Author: Joseph Wright
 ============================================================
-TEST 1: hsb model
+TEST 1: Gray model
 ============================================================
 Defining \l__color_named_foo1_tl on line ...
 Defining \l__color_named_foo1_prop on line ...
 The color foo1 has the properties:
+>  model  =>  gray
+>  gray  =>  0.1333333333333333.
+<recently read> }
+l. ...  }
+The color foo1 has the properties:
+>  model  =>  gray
+>  gray  =>  0.9333333333333333.
+<recently read> }
+l. ...  }
+============================================================
+============================================================
+TEST 2: hsb model
+============================================================
+The color foo1 has the properties:
 >  model  =>  rgb
 >  rgb  =>  0.7 0.567 0.28.
 <recently read> }
@@ -23,7 +37,7 @@ The color foo1 has the properties:
 l. ...  }
 ============================================================
 ============================================================
-TEST 2: Hsb model
+TEST 3: Hsb model
 ============================================================
 The color foo1 has the properties:
 >  model  =>  rgb
@@ -67,7 +81,7 @@ The color foo1 has the properties:
 l. ...  }
 ============================================================
 ============================================================
-TEST 3: Integer/integer-like models
+TEST 4: Integer/integer-like models
 ============================================================
 The color foo1 has the properties:
 >  model  =>  rgb
@@ -88,7 +102,7 @@ The color foo2 has the properties:
 l. ...  }
 ============================================================
 ============================================================
-TEST 4: Exporting colors
+TEST 5: Exporting colors
 ============================================================
 > \l_tmpa_tl={rgb}{0.0 0.0 1.0}.
 <recently read> }
@@ -140,7 +154,7 @@ l. ...  }
 l. ...  }
 ============================================================
 ============================================================
-TEST 5: Exporting color: errors
+TEST 6: Exporting color: errors
 ============================================================
 ! LaTeX3 Error: Unknown export format 'mumble'.
 For immediate help type H <return>.





More information about the latex3-commits mailing list.