Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first attempt at color inversion #60

Merged
merged 4 commits into from
Jan 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions cu-kinovar.sty
Original file line number Diff line number Diff line change
@@ -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}
Expand All @@ -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
11 changes: 9 additions & 2 deletions cu-kruk.sty
Original file line number Diff line number Diff line change
@@ -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/20 v0.2 support for kruk music notations]%
%
%% 'autocolormarks' and noautocolormarks options
\newif\ifcu@autocolormarks
Expand Down Expand Up @@ -38,6 +39,7 @@
\define@key{cuKruk}{topMargin}{\setlength{\cuKrukTopMargin}{#1}}%
\define@key{cuKruk}{sylRuleHeight}{\setlength{\cuKrukSylRuleHeight}{#1}}%
\define@key{cuKruk}{krukRaise}{\setlength{\cuKrukRaise}{#1}}%
\define@boolkey{cuKruk}{invertColor}[true]{}%

\newcommand{\cuKruk}[3][]{%
\bgroup
Expand All @@ -47,7 +49,12 @@
}%
\def\cu@@Kruk#1#2{{%
\edef\cu@tmp{\csname \detokenize{#2}cu@@@\endcsname}%
\setbox1=\hbox{{\cuKrukFont#1}}%
\setbox1=\hbox{{%
\ifKV@cuKruk@invertColor
\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}%
Expand Down