diff options
author | Karl Berry <karl@freefriends.org> | 2022-02-13 21:25:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-02-13 21:25:53 +0000 |
commit | fd51a477ec609d23958713e57fbeffc026afdaaf (patch) | |
tree | 1f9d087c21221360f6551850bb1f93036cb16971 /Master/texmf-dist/doc | |
parent | c7f4af9351d2e5e406973a85376ef74ca65b221f (diff) |
ninecolors (13feb22)
git-svn-id: svn://tug.org/texlive/trunk@62006 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/latex/ninecolors/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/ninecolors/README.txt | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/ninecolors/ninecolors.pdf | bin | 32344 -> 49039 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/ninecolors/ninecolors.tex | 200 |
4 files changed, 147 insertions, 61 deletions
diff --git a/Master/texmf-dist/doc/latex/ninecolors/README b/Master/texmf-dist/doc/latex/ninecolors/README deleted file mode 100644 index 94934f0087e..00000000000 --- a/Master/texmf-dist/doc/latex/ninecolors/README +++ /dev/null @@ -1,4 +0,0 @@ -Ninecolors: Select colors with proper WCAG color contrast -Author : Jianrui Lyu <tolvjr@163.com> -Repository: https://github.com/lvjr/ninecolors -License : The LaTeX Project Public License 1.3 diff --git a/Master/texmf-dist/doc/latex/ninecolors/README.txt b/Master/texmf-dist/doc/latex/ninecolors/README.txt new file mode 100644 index 00000000000..489711d012d --- /dev/null +++ b/Master/texmf-dist/doc/latex/ninecolors/README.txt @@ -0,0 +1,4 @@ +Ninecolors: Select Colors with Proper WCAG Color Contrast +Author : Jianrui Lyu <tolvjr@163.com> and Nan Geng <nangeng@nwafu.edu.cn> +Repository: https://github.com/lvjr/ninecolors +License : The LaTeX Project Public License 1.3 diff --git a/Master/texmf-dist/doc/latex/ninecolors/ninecolors.pdf b/Master/texmf-dist/doc/latex/ninecolors/ninecolors.pdf Binary files differindex 99648b72b17..9e4093584e3 100644 --- a/Master/texmf-dist/doc/latex/ninecolors/ninecolors.pdf +++ b/Master/texmf-dist/doc/latex/ninecolors/ninecolors.pdf diff --git a/Master/texmf-dist/doc/latex/ninecolors/ninecolors.tex b/Master/texmf-dist/doc/latex/ninecolors/ninecolors.tex index 675cb08bebe..65e1aec6f87 100644 --- a/Master/texmf-dist/doc/latex/ninecolors/ninecolors.tex +++ b/Master/texmf-dist/doc/latex/ninecolors/ninecolors.tex @@ -2,72 +2,48 @@ \documentclass{article} \usepackage[a4paper,margin=1.5cm]{geometry} +\newcommand*{\myversion}{2022D} +\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)} +\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi} + \usepackage{ninecolors} \usepackage{arev} \usepackage{pgffor} +\usepackage{l3draw} \usepackage{hyperref} \hypersetup{ colorlinks=true, urlcolor=blue3, } -\newcommand*{\myversion}{2021C} -\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)} -\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi} - -\begin{document} - -\title{\textcolor{blue3}{Ninecolors: select colors with proper WCAG color contrast}% - \footnote{\url{https://github.com/lvjr/ninecolors}}} -\author{Jianrui Lyu (tolvjr@163.com)} -\date{\mydate} -\maketitle - -\textcolor{red4}{Ninecolors} package carefully selects and defines 9 colors for 13 hues each. -All colors with the same suffix number have equal luminance level. -Also color black is of level 0, and color white is of level 10. - -\bigskip +\setlength{\parindent}{0pt} +%\setlength{\parskip}{4pt plus 1pt minus 1pt} -\newcommand{\NineTestBack}{% +\newcommand\NineTestBack{% \foreach \l in {1,...,9} { \noindent \foreach \n in {gray,red,brown,yellow,olive,green,teal,cyan,azure,blue,violet,magenta,purple} {% \xdef\mycolor{\ifnum \l < 5 white\else black\fi}% - \colorbox{\n\l}{\color{\mycolor}\texttt\strut\n\l}% + \colorbox{\n\l}{\color{\mycolor}\strut\n\l}% } \par }} -\NineTestBack - -\bigskip -\newcommand{\NineTestFore}{% +\newcommand\NineTestFore{% \foreach \l in {1,...,9} { \noindent \foreach \n in {gray,red,brown,yellow,olive,green,teal,cyan,azure,blue,violet,magenta,purple} {% \xdef\mycolor{\ifnum \l < 5 gray9\else black\fi}% - \colorbox{\mycolor}{\color{\n\l}\texttt\strut\n\l}% + \colorbox{\mycolor}{\color{\n\l}\strut\n\l}% } \par }} -\NineTestFore - -\bigskip -\hrule -\bigskip - -By simply choosing two colors in the above list, which differ in level by at least 5, -as foreground and background colors, you will get proper -\href{https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html}{WCAG Color Contrast}. - -\bigskip -\newcommand{\NineTestContrast}{% +\newcommand\NineTestContrast{% \colorbox{blue9}{% \strut\color{green3}The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. } @@ -83,22 +59,107 @@ as foreground and background colors, you will get proper \colorbox{brown3}{% \strut\color{violet9}The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. }} -\NineTestContrast + +\newcommand\NineTestSaturation[1]{{% + \NineColors{saturation=#1} + \noindent\centering + \colorbox{white}{\makebox[4em]{\strut #1}}% + \foreach \n in {red,brown,yellow,olive,green,teal,cyan,azure,blue,violet,magenta,purple} + {% + \colorbox{\n5}{\makebox[3em]{\strut\rule[-2ex]{0pt}{5.5ex}TEST}}% + } + \par +}} + +\newcommand\NineTestAllSaturations{% + \NineTestSaturation{high}% + \NineTestSaturation{medium}% + \NineTestSaturation{low}% +} + +\ExplSyntaxOn + +\cs_generate_variant:Nn \color_fill:n { x } +\cs_generate_variant:Nn \color_stroke:n { x } + +\newcommand\NineTestDraw{ + \foreach \l [evaluate=\l~as~\m~using~int(10-\l)] in {1,...,9} + { + \noindent + \foreach \n in {gray,red,brown,yellow,olive,green,teal, + cyan,azure,blue,violet,magenta,purple} + { + \draw_begin: + \draw_scope_begin: + \color_stroke:x { \n\m } + \color_fill:x { \n\l } + \draw_path_circle:nn { 0, 0 } { 10pt } + \draw_path_use_clear:n { stroke, fill } + \draw_scope_end: + \draw_end: + \qquad + } + \par + \vspace*{0.5ex} + } +} + +\ExplSyntaxOff + +\begin{document} + +\title{\textcolor{blue3}{Ninecolors: Select Colors with Proper WCAG Color Contrast}% + \footnote{\url{https://github.com/lvjr/ninecolors}}} +\author{Jianrui Lyu (tolvjr@163.com) \\ Nan Geng (nangeng@nwafu.edu.cn)} +\date{\mydate} +\maketitle + +\section{LaTeX2 Colors with Medium Saturation} + +\textcolor{red4}{Ninecolors} package carefully selects and defines 9 colors for 13 hues each. +All colors with the same suffix number have equal luminance level. +Also color black is of level 0, and color white is of level 10. + +\bigskip + +\NineTestBack + +\medskip + +\NineTestFore + +\bigskip + +By simply choosing two colors in the above list, which differ in level by at least 5, +as foreground and background colors, you will get proper +\href{https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html}{WCAG Color Contrast}. \bigskip -\hrule + +\NineTestContrast + \bigskip If you need to select more contrasting foreground and background colors, which may have other hues, you could visit \href{https://lvjr.bitbucket.io/contrast.html}{WCAG Color Contrast Tool} -page which is designed by the author. +page which is designed by the first author. -\newpage\vspace*{31mm} -\NineColors{saturation=low} +\newpage + +\section{LaTeX2 Colors with Low Saturation} You can change the saturation of colors by {\color{red3}\verb!\NineColors!} command. By default {\color{red3}\verb!saturation=medium!}. -Colors in this page have been changed by {\color{red3}\verb!\NineColors{saturation=low}!}. + +\bigskip + +\NineTestAllSaturations + +\bigskip + +\NineColors{saturation=low} +Colors in the remaining part of the page have been changed by +{\color{red3}\verb!\NineColors{saturation=low}!}. \bigskip @@ -110,13 +171,11 @@ Also color black is of level 0, and color white is of level 10. \NineTestBack -\bigskip +\medskip \NineTestFore \bigskip -\hrule -\bigskip By simply choosing two colors in the above list, which differ in level by at least 5, as foreground and background colors, you will get proper @@ -127,19 +186,27 @@ as foreground and background colors, you will get proper \NineTestContrast \bigskip -\hrule -\bigskip If you need to select more contrasting foreground and background colors, which may have other hues, you could visit \href{https://lvjr.bitbucket.io/contrast.html}{WCAG Color Contrast Tool} -page which is designed by the author. +page which is designed by the first author. -\newpage\vspace*{31mm} -\NineColors{saturation=high} +\newpage + +\section{LaTeX2 Colors with High Saturation} You can change the saturation of colors by {\color{red3}\verb!\NineColors!} command. By default {\color{red3}\verb!saturation=medium!}. -Colors in this page have been changed by {\color{red3}\verb!\NineColors{saturation=high}!}. + +\bigskip + +\NineTestAllSaturations + +\bigskip + +\NineColors{saturation=high} +Colors in the remaining part of the page have been changed by +{\color{red3}\verb!\NineColors{saturation=high}!}. \bigskip @@ -151,13 +218,11 @@ Also color black is of level 0, and color white is of level 10. \NineTestBack -\bigskip +\medskip \NineTestFore \bigskip -\hrule -\bigskip By simply choosing two colors in the above list, which differ in level by at least 5, as foreground and background colors, you will get proper @@ -168,11 +233,32 @@ as foreground and background colors, you will get proper \NineTestContrast \bigskip -\hrule -\bigskip If you need to select more contrasting foreground and background colors, which may have other hues, you could visit \href{https://lvjr.bitbucket.io/contrast.html}{WCAG Color Contrast Tool} -page which is designed by the author. +page which is designed by the first author. + +\newpage + +\section{LaTeX3 Colors for Fun} + +\NineColors{saturation=medium} + +If you are using a LaTeX3 release not older than 2021-07-12, +\textcolor{red4}{Ninecolors} package will define LaTeX3 colors of the same names for you. + +\bigskip + +For example, you can change the color of drawing operations by +{\color{red3}\verb!\color_fill:n {⟨color expression⟩}!} command +for fills, +{\color{red3}\verb!\color_stroke:n {⟨color expression⟩}!} command +for strokes. +%between {\color{red3}\verb!\ExplSyntaxOn!} and +%{\color{red3}\verb!\ExplSyntaxOff!}. + +\bigskip + +\NineTestDraw \end{document} |