| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% TUDa-CI -- Corporate Design for TU Darmstadt |
| 4 |
% ---------------------------------------------------------------------------- |
| 5 |
% |
| 6 |
% Copyright (C) 2018--2025 by Marei Peischl <[email protected]> |
| 7 |
% |
| 8 |
% ============================================================================ |
| 9 |
% This work may be distributed and/or modified under the |
| 10 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 11 |
% of this license or (at your option) any later version. |
| 12 |
% The latest version of this license is in |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 15 |
% version 2008/05/04 or later. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status `maintained'. |
| 18 |
% |
| 19 |
% The Current Maintainer of this work is |
| 20 |
% Marei Peischl <[email protected]> |
| 21 |
% |
| 22 |
% The development repository can be found at |
| 23 |
% https://github.com/tudace/tuda_latex_templates |
| 24 |
% Please use the issue tracker for feedback! |
| 25 |
% |
| 26 |
% ============================================================================ |
| 27 |
% |
| 28 |
% \fi |
| 29 |
% |
| 30 |
% \iffalse |
| 31 |
%<*driver> |
| 32 |
\ProvidesFile{tudacolors.dtx} |
| 33 |
[2025-11-13 v4.05 Color definition for TU Darmstadt's tuda-ci bundle] |
| 34 |
%</driver> |
| 35 |
%<*package> |
| 36 |
%<@@=ptxcd> |
| 37 |
\NeedsTeXFormat{LaTeX2e}[2020-10-01] |
| 38 |
\ProvidesExplPackage{tudacolors}{2025-11-13}{4.05}{Color definition for TU Darmstadt's tuda-ci bundle} |
| 39 |
%</package> |
| 40 |
%<*driver> |
| 41 |
\providecommand*{\TUDaDocDTXfiles}{tudacolors.dtx} |
| 42 |
\input{tuda-ci.dtx} |
| 43 |
%</driver> |
| 44 |
% \fi |
| 45 |
% \chapter{\pkg{tudacolors} –– Color definitions} |
| 46 |
% \label{sec:color} |
| 47 |
% The \pkg{tudacolors} package provides the general color definitions necessary for the TUDa-CI Templates. |
| 48 |
% It defines the colors according to the design guideline \cite{TUDaGuideline}. |
| 49 |
% The definitions are using the \pkg{xcolor} package \cite{xcolor}. |
| 50 |
% Additionally the \option{mecheng} specific colors (see \autoref{sec:mecheng-color}) but the additional colors used by the new \cls{tudabeamer} layout are provided directly in the color theme. |
| 51 |
% This is because right now these colors are only defined in RGB mode and should not be used in documents using CMYK colors. |
| 52 |
% |
| 53 |
% The colors can be used like within standard \LaTeX. |
| 54 |
% The predefined TUDa-CI specific colors are: |
| 55 |
% |
| 56 |
% \begin{multicols}{4} |
| 57 |
% \raggedright |
| 58 |
% \renewcommand*{\definecolor}[3]{\makebox[5em]{#1}\textcolor{#1}{\rule{1cm}{\ht\strutbox}}\par} |
| 59 |
% \input{tudacolors.def} |
| 60 |
% \end{multicols} |
| 61 |
% |
| 62 |
% \pkg{tudacolors} provides package options to allow color selection or the color mode. |
| 63 |
% Since \pkg{tudacolors} is usually not loaded directly but indirectly using one of the TUDa-CI document classes, the options can be added as class options, as described in \autoref{sec:options}. |
| 64 |
% They will be passed to the package. |
| 65 |
% \begin{implementation} |
| 66 |
% \section{Implementation} |
| 67 |
% |
| 68 |
% \iffalse |
| 69 |
%<*package> |
| 70 |
% \fi |
| 71 |
% \begin{macrocode} |
| 72 |
\str_if_exist:NF \g_ptxcd_department_str { |
| 73 |
\str_new:N \g_ptxcd_department_str |
| 74 |
\str_gset:Nn \g_ptxcd_department_str {default} |
| 75 |
} |
| 76 |
\keys_define:nn {ptxcd/colors} { |
| 77 |
% \end{macrocode} |
| 78 |
% \end{implementation} |
| 79 |
% |
| 80 |
% \begin{documentation} |
| 81 |
% \DescribeKeyOption{accentcolor=\meta{Color}}{0b}* |
| 82 |
% \DescribeOption{accent=} |
| 83 |
% |
| 84 |
% Highlight color used for all highlight elements by default. |
| 85 |
% The options below will reference this color as default setting meta{accentcolor}. |
| 86 |
% Depending on the documentclass it might be used for the so-called \enquote{identbar} as well as highlighted test elements, e.\,g. within letters if \option{premium} is enabled. |
| 87 |
% |
| 88 |
% |accent| is an alias. |
| 89 |
% We recommend using |accentcolor| to simplify recognizing the purpose of that option. |
| 90 |
% \end{documentation} |
| 91 |
% |
| 92 |
% \begin{implementation} |
| 93 |
% \begin{optionenv}{accent=} |
| 94 |
% \begin{macrocode} |
| 95 |
accent .tl_gset:N = \g_ptxcd_color_accent_tl, |
| 96 |
accent .initial:n = 0b, |
| 97 |
accentcolor .meta:n = {accent =#1}, |
| 98 |
% \end{macrocode} |
| 99 |
% \end{optionenv}^^A accent |
| 100 |
% \end{implementation} |
| 101 |
% |
| 102 |
% \begin{documentation} |
| 103 |
% \DescribeKeyOption{textaccent=\meta{color}}{\meta{accentcolor}}* |
| 104 |
% The accent color for highlighted text. Usage depends on the document class. |
| 105 |
% \end{documentation} |
| 106 |
% |
| 107 |
% \begin{implementation} |
| 108 |
% \begin{optionenv}{textaccent=\meta{color}} |
| 109 |
% \begin{macrocode} |
| 110 |
textaccent .tl_gset:N = \g_ptxcd_color_textaccent_tl, |
| 111 |
textaccent .initial:n = \g_ptxcd_color_accent_tl, |
| 112 |
textaccentcolor .meta:n = {textaccent = #1}, |
| 113 |
% \end{macrocode} |
| 114 |
% \end{optionenv}^^A textaccent |
| 115 |
% \end{implementation} |
| 116 |
% |
| 117 |
% \begin{documentation} |
| 118 |
% \DescribeKeyOption{identbar=\meta{color}}{\meta{accentcolor}}* |
| 119 |
% Color of the colored bar on the top of the page or slides using the 2008 layout. |
| 120 |
% \end{documentation} |
| 121 |
% |
| 122 |
% \begin{implementation} |
| 123 |
% \begin{optionenv}{identbar=\meta{color}} |
| 124 |
% \begin{macrocode} |
| 125 |
identbar .tl_gset:N = \g_ptxcd_color_identbar_tl, |
| 126 |
identbar .initial:n = \g_ptxcd_color_accent_tl, |
| 127 |
identbarcolor .meta:n = {identbar = #1}, |
| 128 |
% \end{macrocode} |
| 129 |
% \end{optionenv}^^A identbar |
| 130 |
% compatibility only |
| 131 |
% \begin{macrocode} |
| 132 |
color .code:n = { |
| 133 |
\keys_set:nn {ptxcd/colors} { |
| 134 |
accent=#1, |
| 135 |
textaccent=#1, |
| 136 |
identbar=#1 |
| 137 |
} |
| 138 |
\PassOptionsToPackage{color=}{siunitx} |
| 139 |
}, |
| 140 |
% \end{macrocode} |
| 141 |
% \end{implementation} |
| 142 |
% |
| 143 |
% \begin{documentation} |
| 144 |
% \DescribeKeyOption{text=preferblack/preferwhite}{preferwhite}* |
| 145 |
% The text placed on top a colored area, e.\,g. if the background of the title is set colored is either set to black or white. |
| 146 |
% There are some color combinations forbidded according to the design guideline \cite{TUDaGuideline} and some colors are allowed to use black or white. |
| 147 |
% This option can be used to prefer either black or white for the title in case both variants are allowed. |
| 148 |
% It's not possible to enforce a forbidden setting using this option. |
| 149 |
% \end{documentation} |
| 150 |
% |
| 151 |
% \begin{implementation} |
| 152 |
% \begin{optionenv}{text} |
| 153 |
% \begin{macrocode} |
| 154 |
text .choice:, |
| 155 |
text/preferblack .code:n = \bool_gset_false:N \g_ptxcd_color_whitetext_bool, |
| 156 |
text/preferwhite .code:n = \bool_gset_true:N \g_ptxcd_color_whitetext_bool, |
| 157 |
text .initial:n = {preferwhite}, |
| 158 |
text/black .meta:n = {text=preferblack}, |
| 159 |
text/white .meta:n = {text=preferwhite}, |
| 160 |
% \end{macrocode} |
| 161 |
% \end{optionenv}^^A text |
| 162 |
% \end{implementation} |
| 163 |
% \begin{documentation} |
| 164 |
% \DescribeKeyOption*{colormode=cmyk/RGB}{Depends on document type}* |
| 165 |
% The colormode can be selected to overwrite the default setting. |
| 166 |
% Please be aware, that there is a difference in casing and \code{RGB} has to be used uppercase and \code{cmyk} lowercase. |
| 167 |
% The reason for this is that internally uppercase and lowercase model names slightly differ because of rounding. |
| 168 |
% \end{documentation} |
| 169 |
% \begin{implementation} |
| 170 |
% \begin{optionenv}{cmyk, RGB} |
| 171 |
% \begin{macrocode} |
| 172 |
cmyk .code:n = \cs_if_exist:NTF \selectcolormodel |
| 173 |
{\selectcolormodel{cmyk}} |
| 174 |
{\PassOptionsToPackage{cmyk}{xcolor}}, |
| 175 |
RGB .code:n = \cs_if_exist:NTF \selectcolormodel |
| 176 |
{\selectcolormodel{RGB}} |
| 177 |
{\PassOptionsToPackage{RGB}{xcolor}}, |
| 178 |
% \end{macrocode} |
| 179 |
% \end{optionenv} |
| 180 |
% \end{implementation} |
| 181 |
% \begin{documentation} |
| 182 |
% \DescribeKeyOption{department=default/mecheng/\meta{department}}{default}* |
| 183 |
% Within \pkg{tudacolors} it's only checked if the department was set to \option{mecheng}. In that case the additional color configuration will be enbled (\autoref{sec:mecheng}). |
| 184 |
% \end{documentation} |
| 185 |
% \begin{implementation} |
| 186 |
% \begin{optionenv}{department=} |
| 187 |
% \begin{macrocode} |
| 188 |
department .choice:, |
| 189 |
department / default .code:n = \str_gset:Nn \g_ptxcd_department_str {default}, |
| 190 |
department / mecheng .code:n = { |
| 191 |
\str_gset:Nn \g_ptxcd_department_str {mecheng} |
| 192 |
\keys_set:nn {ptxcd/colors}{ |
| 193 |
accent=TUDa-2d, |
| 194 |
identbar=TUDa-6b |
| 195 |
} |
| 196 |
}, |
| 197 |
department / unknown .code:n = { |
| 198 |
\str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} |
| 199 |
}, |
| 200 |
% \end{macrocode} |
| 201 |
% Necessary to apply the option if it was processed before. |
| 202 |
% \begin{macrocode} |
| 203 |
department .initial:V = \g_ptxcd_department_str, |
| 204 |
% \end{macrocode} |
| 205 |
% \end{optionenv}^^A department |
| 206 |
% \end{implementation} |
| 207 |
% \begin{implementation} |
| 208 |
% \begin{macrocode} |
| 209 |
departmentconfigprefix .tl_gset:N = \g_@@_config_prefix_tl, |
| 210 |
mecheng .meta:n = {department=mecheng}, |
| 211 |
} |
| 212 |
\ProcessKeyOptions[ptxcd/colors] |
| 213 |
\RequirePackage{xcolor} |
| 214 |
\input{tudacolors.def} |
| 215 |
\str_if_eq:VnT \g_ptxcd_department_str {mecheng} { |
| 216 |
\colorlet{TUDa-Primary1}{TUDa-6b} |
| 217 |
\colorlet{TUDa-Primary2}{TUDa-2d} |
| 218 |
\colorlet{TUDa-Secondary1}{TUDa-9a} |
| 219 |
\colorlet{TUDa-Secondary2}{TUDa-8a} |
| 220 |
\colorlet{TUDa-Secondary3}{TUDa-6a} |
| 221 |
\colorlet{TUDa-Secondary4}{TUDa-3a} |
| 222 |
\colorlet{TUDa-Secondary5}{TUDa-4a} |
| 223 |
\colorlet{TUDa-Secondary6}{TUDa-5a} |
| 224 |
\colorlet{TUDa-Arrow}{TUDa-Primary2} |
| 225 |
} |
| 226 |
\clist_const:Nn \c_ptxcd_color_forbid_textaccent_clist {TUDa-0a,TUDa-5a,TUDa-6a,TUDa-6b,TUDa-7a} |
| 227 |
\clist_const:Nn \c_ptxcd_color_allow_blacktext_clist {TUDa-0a,TUDa-0b,TUDa-0c,TUDa-1a,TUDa-2a,TUDa-3a,TUDa-4a,TUDa-4b,TUDa-4c,TUDa-5a,TUDa-5b,TUDa-5c,TUDa-6a,TUDa-6b,TUDa-6c,TUDa-7a,TUDa-7b,TUDa-7c,TUDa-8a,TUDa-8b,TUDa-8c,TUDa-9a,TUDa-9b,TUDa-10a} |
| 228 |
\clist_const:Nn \c_ptxcd_color_allow_whitetext_clist {TUDa-0b,TUDa-0c,TUDa-0d,black,TUDa-1a,TUDa-1b,TUDa-1c,TUDa-1d,TUDa-2a,TUDa-2b,TUDa-2c,TUDa-2d,TUDa-3a,TUDa-3b,TUDa-3c,TUDa-3d,TUDa-4b,TUDa-4c,TUDa-4d,TUDa-5b,TUDa-5c,TUDa-5d,TUDa-6c,TUDa-6d,TUDa-7b,TUDa-7c,TUDa-7d,TUDa-8a,TUDa-8b,TUDa-8c,TUDa-8d,TUDa-9a,TUDa-9b,TUDa-9c,TUDa-9d,TUDa-10a,TUDa-10b,TUDa-10c,TUDa-10d,TUDa-11a,TUDa-11b,TUDa-11c,TUDa-11d} |
| 229 |
% \end{macrocode} |
| 230 |
% messages |
| 231 |
% \begin{macrocode} |
| 232 |
\msg_new:nnnn{tudacolors} {undefined-color} {The~ color~ #1~ you~ selected~ is~ not~ defined.} {See~ the~ tuda-ci~ manual~ for~ a~ list~ of~ available~ colors.} |
| 233 |
\msg_new:nnnn{tudacolors} {unselectable-color} {The~ color~ you~ selected~ (#1)~ must~ not~ be~ choosen~ for~ #2.} {See~ the~ Corporate~ Design~ Guideline~ for~ further~ information.} |
| 234 |
\hook_new:n {ptxcd/init-colors} |
| 235 |
\hook_gput_code:nnn {ptxcd/init-colors} {tudacolors} { |
| 236 |
\clist_map_inline:nn {accent, textaccent, identbar} { |
| 237 |
\cs_if_exist:cF {\string\color@\tl_use:c {g_ptxcd_color_#1_tl}} { |
| 238 |
\cs_if_exist:cT {\string\color@TUDa-\tl_use:c {g_ptxcd_color_#1_tl}} { |
| 239 |
\tl_gset:cx {g_ptxcd_color_#1_tl} {TUDa-\tl_use:c {g_ptxcd_color_#1_tl}} |
| 240 |
} |
| 241 |
} |
| 242 |
} |
| 243 |
\exp_args:Nnx \colorlet{accentcolor}{\g_ptxcd_color_accent_tl} |
| 244 |
\bool_if:NTF \g_ptxcd_color_whitetext_bool { |
| 245 |
\clist_if_in:NVTF \c_ptxcd_color_allow_whitetext_clist \g_ptxcd_color_accent_tl { |
| 246 |
\colorlet{textonaccentcolor}{white} |
| 247 |
} { |
| 248 |
\colorlet{textonaccentcolor}{black} |
| 249 |
\tl_if_in:NnT \g_ptxcd_color_accent_tl {TUDa} { |
| 250 |
\msg_warning:nnxx{tudacolors} {unselectable-color} {white} {textonaccentcolor} |
| 251 |
} |
| 252 |
} |
| 253 |
} { |
| 254 |
\clist_if_in:NVTF \c_ptxcd_color_allow_blacktext_clist \g_ptxcd_color_accent_tl { |
| 255 |
\colorlet{textonaccentcolor}{black} |
| 256 |
} { |
| 257 |
\colorlet{textonaccentcolor}{white} |
| 258 |
\tl_if_in:NnT \g_ptxcd_color_accent_tl {TUDa} { |
| 259 |
\msg_warning:nnxx{tudacolors} {unselectable-color} {black} {textonaccentcolor} |
| 260 |
} |
| 261 |
} |
| 262 |
} |
| 263 |
\colorlet{identbarcolor}{\g_ptxcd_color_identbar_tl} |
| 264 |
\exp_args:NNx \clist_if_in:NnTF \c_ptxcd_color_forbid_textaccent_clist {\g_ptxcd_color_textaccent_tl} { |
| 265 |
\msg_warning:nnxx{tudacolors} {unselectable-color} {\g_ptxcd_color_textaccent_tl} {textaccentcolor} |
| 266 |
\colorlet{textaccentcolor}{black} |
| 267 |
} { |
| 268 |
\colorlet{textaccentcolor}{\g_ptxcd_color_textaccent_tl} |
| 269 |
} |
| 270 |
} |
| 271 |
\file_if_exist_input:n {\g_@@_config_prefix_tl\g_ptxcd_department_str-colors.def} |
| 272 |
\hook_use:n {ptxcd/init-colors} |
| 273 |
\colorlet{InfoBox}{white} |
| 274 |
% \end{macrocode} |
| 275 |
% \end{implementation} |
| 276 |
% \iffalse |
| 277 |
%</package> |
| 278 |
% \fi |
| 279 |
% |
| 280 |
% \Finale |
| 281 |
\endinput |