[latex3-commits] [git/LaTeX3-latex3-latex3] master: Added support for "hsb" color (21a0acc8d)

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


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

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

commit 21a0acc8dc1e89aec578525f890b5e45e2b582c8
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Aug 10 10:03:22 2020 +0100

    Added support for "hsb" color
    
    Mainly to deal with xcolor.


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

21a0acc8dc1e89aec578525f890b5e45e2b582c8
 l3experimental/CHANGELOG.md                     |  3 +++
 l3experimental/l3color/l3color.dtx              |  5 +++++
 l3experimental/l3color/testfiles/m3color002.lvt | 10 +++++++++
 l3experimental/l3color/testfiles/m3color002.tlg | 27 +++++++++++++++++++++----
 4 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/l3experimental/CHANGELOG.md b/l3experimental/CHANGELOG.md
index bf4577912..7ee9c5b0f 100644
--- a/l3experimental/CHANGELOG.md
+++ b/l3experimental/CHANGELOG.md
@@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Added
+- Support for `hsb` color model
+
 ## [2020-08-07]
 
 ### Changed
diff --git a/l3experimental/l3color/l3color.dtx b/l3experimental/l3color/l3color.dtx
index f36c41ecf..48d7a90b5 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{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
 %     in the range $[0,360]$ for hue, real values in the range $[0,1]$ for
 %     saturation and brightness
@@ -858,10 +860,13 @@
 %
 % \begin{macro}[EXP]
 %   {
+%     \@@_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_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
   {
     \exp_args:Ne \@@_parse_model_hsb:nnn { \fp_eval:n { #1 / 360 } }
diff --git a/l3experimental/l3color/testfiles/m3color002.lvt b/l3experimental/l3color/testfiles/m3color002.lvt
index a2ad42cf5..6d5fbb5c6 100644
--- a/l3experimental/l3color/testfiles/m3color002.lvt
+++ b/l3experimental/l3color/testfiles/m3color002.lvt
@@ -18,6 +18,16 @@
 
 \ExplSyntaxOn
 
+\TEST { hsb~model }
+  {
+    \color_set:nnn { foo1 } { hsb } { 0.11389 , 0.6 , 0.7 }
+    \color_show:n { foo1 }
+    \color_set:nnn { foo1 } { hsb } { 0.18056 , 0.6 , 0.7 }
+    \color_show:n { foo1 }
+    \color_set:nnn { foo1 } { hsb } { 0.34722 , 0.6 , 0.7 }
+    \color_show:n { foo1 }
+  }
+
 \TEST { Hsb~model }
   {
     \color_set:nnn { foo1 } { Hsb } { 5 , 0.6 , 0.7 }
diff --git a/l3experimental/l3color/testfiles/m3color002.tlg b/l3experimental/l3color/testfiles/m3color002.tlg
index ad231acdf..098fea03f 100644
--- a/l3experimental/l3color/testfiles/m3color002.tlg
+++ b/l3experimental/l3color/testfiles/m3color002.tlg
@@ -2,12 +2,31 @@ 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: hsb model
 ============================================================
 Defining \l__color_named_foo1_tl on line ...
 Defining \l__color_named_foo1_prop on line ...
 The color foo1 has the properties:
 >  model  =>  rgb
+>  rgb  =>  0.7 0.567 0.28.
+<recently read> }
+l. ...  }
+The color foo1 has the properties:
+>  model  =>  rgb
+>  rgb  =>  0.66499 0.7 0.28.
+<recently read> }
+l. ...  }
+The color foo1 has the properties:
+>  model  =>  rgb
+>  rgb  =>  0.28 0.7 0.31499.
+<recently read> }
+l. ...  }
+============================================================
+============================================================
+TEST 2: Hsb model
+============================================================
+The color foo1 has the properties:
+>  model  =>  rgb
 >  rgb  =>  0.7 0.315 0.28.
 <recently read> }
 l. ...  }
@@ -48,7 +67,7 @@ The color foo1 has the properties:
 l. ...  }
 ============================================================
 ============================================================
-TEST 2: Integer/integer-like models
+TEST 3: Integer/integer-like models
 ============================================================
 The color foo1 has the properties:
 >  model  =>  rgb
@@ -69,7 +88,7 @@ The color foo2 has the properties:
 l. ...  }
 ============================================================
 ============================================================
-TEST 3: Exporting colors
+TEST 4: Exporting colors
 ============================================================
 > \l_tmpa_tl={rgb}{0.0 0.0 1.0}.
 <recently read> }
@@ -121,7 +140,7 @@ l. ...  }
 l. ...  }
 ============================================================
 ============================================================
-TEST 4: Exporting color: errors
+TEST 5: Exporting color: errors
 ============================================================
 ! LaTeX3 Error: Unknown export format 'mumble'.
 For immediate help type H <return>.





More information about the latex3-commits mailing list.