From 189678203d08d475557f2c5c0b8f950acad7237a Mon Sep 17 00:00:00 2001 From: Mike Kroutikov Date: Thu, 18 Apr 2019 19:57:22 -0400 Subject: [PATCH 1/4] first attempt at color inversion --- cu-kruk.sty | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cu-kruk.sty b/cu-kruk.sty index 57c6811..16b8af1 100644 --- a/cu-kruk.sty +++ b/cu-kruk.sty @@ -1,7 +1,8 @@ \NeedsTeXFormat{LaTeX2e}% \RequirePackage{keyval}% \RequirePackage{ifluatex}% -\ProvidesPackage{cu-kruk}[2018/03/01 v0.1 support for kruk music notations]% +\RequirePackage{cu-kinovar}% +\ProvidesPackage{cu-kruk}[2019/04/18 v0.2 support for kruk music notations]% % %% 'autocolormarks' and noautocolormarks options \newif\ifcu@autocolormarks @@ -27,17 +28,25 @@ \newlength{\cuKrukTopMargin} %% top margin ensures that lines are nicely separated \newlength{\cuKrukSylRuleHeight} %% how thick placeholder rule is \newlength{\cuKrukRaise} %% distance between text and kruk baselines +\newif{\ifcuKrukInvertColor} %% invert pometa colors % \setlength{\cuKrukSylSpace}{0.2em} \setlength{\cuKrukTopMargin}{0.3em} \setlength{\cuKrukSylRuleHeight}{0.08em} \setlength{\cuKrukRaise}{1em} +\cuKrukInvertColorfalse \define@key{cuKruk}{krukFont}{\def\cuKrukFont{#1}}% \define@key{cuKruk}{sylSpace}{\setlength{\cuKrukSylSpace}{#1}}% \define@key{cuKruk}{topMargin}{\setlength{\cuKrukTopMargin}{#1}}% \define@key{cuKruk}{sylRuleHeight}{\setlength{\cuKrukSylRuleHeight}{#1}}% \define@key{cuKruk}{krukRaise}{\setlength{\cuKrukRaise}{#1}}% +\define@key{cuKruk}{invertColor}{% + \ifcu@autocolormarks + \cuKrukInvertColortrue + \fi +} +\definecolor{black}{rgb}{0.00,0.00,0.00} \newcommand{\cuKruk}[3][]{% \bgroup @@ -101,6 +110,11 @@ \def\cu@KrukPara[#1]#2\\#3\cu@End{% \bgroup \setkeys{cuKruk}{#1}% +\ifcuKrukInvertColor + \def\cu@kinovar#1{\textcolor{black}{#1}}% + \def\cu@kinovar@color#1{\color{black}}% + \cu@kinovar@color +\fi \setcounter{cu@KrukPos}{0}% \setcounter{cu@SylPos}{0}% \cu@Kruk #2 \cu@EndKruk From 2b2eefeeee613757cff04bc6bbd8e8905040098f Mon Sep 17 00:00:00 2001 From: Mike Kroutikov Date: Sat, 20 Apr 2019 14:42:54 -0400 Subject: [PATCH 2/4] fixed color inversion --- cu-kinovar.sty | 31 ++++++++++++------------------- cu-kruk.sty | 24 +++++++++--------------- 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/cu-kinovar.sty b/cu-kinovar.sty index 6f713f4..e3721a4 100644 --- a/cu-kinovar.sty +++ b/cu-kinovar.sty @@ -1,4 +1,4 @@ -\ProvidesPackage{cu-kinovar}[2016/03/31 v1.0 CU Kinovar] +\ProvidesPackage{cu-kinovar}[2019/04/20 v1.1 CU Kinovar] \RequirePackage{cu-util} \RequirePackage{etoolbox} @@ -8,38 +8,31 @@ \RequirePackage{luacolor} \fi -%% 'color' option (default) -\def\cu@kinovar{\relax} -\def\cu@kinovar@color{\relax} +\newcommand{\cu@kinovar}[1]{\textcolor{kinovar}{#1}} +\newcommand{\cuKinovarColor}{\color{kinovar}} \DeclareOption{color}{ - \renewcommand{\cu@kinovar}[1]{\textcolor{kinovar}{#1}} - \renewcommand{\cu@kinovar@color}{\color{kinovar}} + \colorlet{kinovar}{kinovar-red} } \DeclareOption{gray}{ - \renewcommand{\cu@kinovar}[1]{\textcolor{kinovar-gray}{#1}} - \renewcommand{\cu@kinovar@color}{\color{kinovar-gray}} + \colorlet{kinovar}{kinovar-gray} } \DeclareOption{grey}{ - \renewcommand{\cu@kinovar}[1]{\textcolor{kinovar-gray}{#1}} - \renewcommand{\cu@kinovar@color}{\color{kinovar-gray}} + \colorlet{kinovar}{kinovar-gray} } \DeclareOption{bw}{ - \renewcommand{\cu@kinovar}[1]{#1} - \renewcommand{\cu@kinovar@color}{\relax} + \colorlet{kinovar}{kinovar-black} } -\ExecuteOptions{color} -\ProcessOptions\relax - % define standard colors -\definecolor{kinovar}{rgb}{0.80,0.03,0.01} +\definecolor{kinovar-red}{rgb}{0.80,0.03,0.01} +\colorlet{kinovar-black}{.} \definecolor{kinovar-gray}{rgb}{0.45,0.45,0.45} +\ExecuteOptions{color} +\ProcessOptions\relax + % cuKinovar command colors just one letter with all accents if any \newrobustcmd{\cuKinovar}{\cu@tokenizeletter{\cu@kinovar}} -% cuKinovarColorr switches foregrouond color to Kinovar -\newrobustcmd{\cuKinovarColor}{\cu@kinovar@color} - \endinput diff --git a/cu-kruk.sty b/cu-kruk.sty index 16b8af1..bab141c 100644 --- a/cu-kruk.sty +++ b/cu-kruk.sty @@ -2,7 +2,7 @@ \RequirePackage{keyval}% \RequirePackage{ifluatex}% \RequirePackage{cu-kinovar}% -\ProvidesPackage{cu-kruk}[2019/04/18 v0.2 support for kruk music notations]% +\ProvidesPackage{cu-kruk}[2019/04/20 v0.2 support for kruk music notations]% % %% 'autocolormarks' and noautocolormarks options \newif\ifcu@autocolormarks @@ -28,25 +28,18 @@ \newlength{\cuKrukTopMargin} %% top margin ensures that lines are nicely separated \newlength{\cuKrukSylRuleHeight} %% how thick placeholder rule is \newlength{\cuKrukRaise} %% distance between text and kruk baselines -\newif{\ifcuKrukInvertColor} %% invert pometa colors % \setlength{\cuKrukSylSpace}{0.2em} \setlength{\cuKrukTopMargin}{0.3em} \setlength{\cuKrukSylRuleHeight}{0.08em} \setlength{\cuKrukRaise}{1em} -\cuKrukInvertColorfalse \define@key{cuKruk}{krukFont}{\def\cuKrukFont{#1}}% \define@key{cuKruk}{sylSpace}{\setlength{\cuKrukSylSpace}{#1}}% \define@key{cuKruk}{topMargin}{\setlength{\cuKrukTopMargin}{#1}}% \define@key{cuKruk}{sylRuleHeight}{\setlength{\cuKrukSylRuleHeight}{#1}}% \define@key{cuKruk}{krukRaise}{\setlength{\cuKrukRaise}{#1}}% -\define@key{cuKruk}{invertColor}{% - \ifcu@autocolormarks - \cuKrukInvertColortrue - \fi -} -\definecolor{black}{rgb}{0.00,0.00,0.00} +\define@boolkey{cuKruk}{invertColor}[true]{}% \newcommand{\cuKruk}[3][]{% \bgroup @@ -56,7 +49,13 @@ }% \def\cu@@Kruk#1#2{{% \edef\cu@tmp{\csname \detokenize{#2}cu@@@\endcsname}% - \setbox1=\hbox{{\cuKrukFont#1}}% + \setbox1=\hbox{{% + \ifKV@cuKruk@invertColor + \message{inverting colors}% + \colorlet{tmp}{.}\color{kinovar}\colorlet{kinovar}{tmp}% + \fi + \cuKrukFont#1 + }}% \dimen0=\ht1\advance\dimen0 by \cuKrukTopMargin\ht1=\dimen0% \if\relax\detokenize{#2}\relax \setbox2=\hbox{\vrule height \cuKrukSylRuleHeight width \wd1}% @@ -110,11 +109,6 @@ \def\cu@KrukPara[#1]#2\\#3\cu@End{% \bgroup \setkeys{cuKruk}{#1}% -\ifcuKrukInvertColor - \def\cu@kinovar#1{\textcolor{black}{#1}}% - \def\cu@kinovar@color#1{\color{black}}% - \cu@kinovar@color -\fi \setcounter{cu@KrukPos}{0}% \setcounter{cu@SylPos}{0}% \cu@Kruk #2 \cu@EndKruk From 17e230ad55f8462fa27b4aafb9371ed6ba11f2aa Mon Sep 17 00:00:00 2001 From: Mike Kroutikov Date: Sat, 20 Apr 2019 14:45:39 -0400 Subject: [PATCH 3/4] cleanup --- cu-kruk.sty | 1 - 1 file changed, 1 deletion(-) diff --git a/cu-kruk.sty b/cu-kruk.sty index bab141c..accd10a 100644 --- a/cu-kruk.sty +++ b/cu-kruk.sty @@ -51,7 +51,6 @@ \edef\cu@tmp{\csname \detokenize{#2}cu@@@\endcsname}% \setbox1=\hbox{{% \ifKV@cuKruk@invertColor - \message{inverting colors}% \colorlet{tmp}{.}\color{kinovar}\colorlet{kinovar}{tmp}% \fi \cuKrukFont#1 From a05c8c2bcb144c01b8e945b7e5de3ab293b58dbd Mon Sep 17 00:00:00 2001 From: Mike Kroutikov Date: Sat, 20 Apr 2019 14:46:32 -0400 Subject: [PATCH 4/4] cleanup --- cu-kruk.sty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cu-kruk.sty b/cu-kruk.sty index accd10a..11dc43c 100644 --- a/cu-kruk.sty +++ b/cu-kruk.sty @@ -53,7 +53,7 @@ \ifKV@cuKruk@invertColor \colorlet{tmp}{.}\color{kinovar}\colorlet{kinovar}{tmp}% \fi - \cuKrukFont#1 + \cuKrukFont#1% }}% \dimen0=\ht1\advance\dimen0 by \cuKrukTopMargin\ht1=\dimen0% \if\relax\detokenize{#2}\relax