\definecolor{flmxAnnotatorColor0}{RGB}{0,148,240}
\definecolor{flmxAnnotatorColor1}{RGB}{242,108,13}
\definecolor{flmxAnnotatorColor2}{RGB}{65,149,42}
\definecolor{flmxAnnotatorColor3}{RGB}{128,55,134}
\definecolor{flmxAnnotatorColor4}{RGB}{0,129,129}
\definecolor{flmxAnnotatorColor5}{RGB}{148,7,24}
\definecolor{flmxAnnotatorColor6}{RGB}{160,120,0}
\definecolor{flmxAnnotatorColor7}{RGB}{35,195,155}
\colorlet{flmxAnnotatorColorFallback}{red}
\ExplSyntaxOn
\tl_new:N \l__flmx_annotations_kinds_tl
\tl_new:N \l__flmx_annotations_number_tl
\NewExpandableDocumentCommand \flmxAnnotatorColor { }
{ \__flmx_annotations_color:e { \__flmx_annotations_number: } }
\cs_new:Npn \__flmx_annotations_color:n #1
{
\bool_lazy_and:nnTF
{ ! \tl_if_blank_p:n {#1} }
{ \int_compare_p:nNn {#1} < { 8 } }
{ flmxAnnotatorColor #1 }
{ flmxAnnotatorColorFallback }
}
\cs_generate_variant:Nn \__flmx_annotations_color:n { e }
\cs_new:Npn \__flmx_annotations_number:
{
\exp_last_unbraced:Ne \__flmx_annotations_number:w
{ \flmxKey { kinds } \c_space_tl annotator- \c_space_tl }
\q_stop
}
\cs_new:Npn \__flmx_annotations_number:w #1 annotator- #2 \q_stop
{ \tl_if_blank:nF {#2} { \__flmx_annotations_digits:w #2 ~ \q_stop } }
\cs_new:Npn \__flmx_annotations_digits:w #1 ~ #2 \q_stop {#1}
\prg_new_protected_conditional:Npnn \__flmx_annotations_if_kind:n #1 { T, F, TF }
{
\tl_set:Ne \l__flmx_annotations_kinds_tl { \flmxKey { kinds } }
\tl_replace_all:Nnn \l__flmx_annotations_kinds_tl { ~ } { , }
\clist_if_in:NnTF \l__flmx_annotations_kinds_tl {#1}
{ \prg_return_true: }
{ \prg_return_false: }
}
\cs_new_protected:Npn \__flmx_annotations_anchor:
{ \flmxIfKey { anchor } { \flmxTarget { \flmxKey { anchor } } } { } }
\flmxDefineSpan { flm.annotations.highlight }
{ \__flmx_annotations_anchor: \textcolor { \flmxAnnotatorColor } {#1} }
\flmxDefineSpan { flm.annotations.comment }
{
\__flmx_annotations_anchor:
\textcolor { \flmxAnnotatorColor }
{
\sffamily
\__flmx_annotations_if_kind:nF { mark-continued } { [ }
#1
\__flmx_annotations_if_kind:nF { mark-continues } { ] }
}
}
\flmxDefineSpan { flm.annotations.initials }
{ \__flmx_annotations_anchor: \textcolor { \flmxAnnotatorColor } { \sffamily #1 } }
\flmxDefineBlock { flm.annotations.highlight }
{ \par \__flmx_annotations_anchor: \color { \flmxAnnotatorColor } }
{ \par }
\flmxDefineBlock { flm.annotations.comment }
{
\par \__flmx_annotations_anchor: \color { \flmxAnnotatorColor } \sffamily
\__flmx_annotations_if_kind:nF { mark-continued } { \noindent [ \par }
}
{
\par
\__flmx_annotations_if_kind:nF { mark-continues } { \noindent ] \par }
}
\ExplSyntaxOff