From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/tuda-ci/tex/tudacolors.sty | 108 ++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 macros/latex/contrib/tuda-ci/tex/tudacolors.sty (limited to 'macros/latex/contrib/tuda-ci/tex/tudacolors.sty') diff --git a/macros/latex/contrib/tuda-ci/tex/tudacolors.sty b/macros/latex/contrib/tuda-ci/tex/tudacolors.sty new file mode 100644 index 0000000000..4672c39364 --- /dev/null +++ b/macros/latex/contrib/tuda-ci/tex/tudacolors.sty @@ -0,0 +1,108 @@ +%% This is file `tudacolors.sty' version 1.01 (2019/08/05), +%% it is part of +%% TUDa-CI -- Corporate Design for TU Darmstadt +%% ---------------------------------------------------------------------------- +%% +%% Copyright (C) 2018--2019 by Marei Peischl +%% +%% ============================================================================ +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainers of this work are +%% Marei Peischl +%% Markus Lazanowski +%% +%% The development respository can be found at +%% https://github.com/tudace/tuda_latex_templates +%% Please use the issue tracker for feedback! +%% +%% ============================================================================ +%% +\def\fileversion{1.01} +\def\filedate{2019/08/05} +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplPackage{tudacolors}{\filedate}{\fileversion}{Color definition for TU Darmstadt's tuda-ci bundle} + +\RequirePackage{l3keys2e} + +\keys_define:nn {TUDa/colors} { + accent .tl_gset:N = \g_TUDa_color_accent_tl, + accent .initial:n = 0b, + textaccent .tl_gset:N = \g_TUDa_color_textaccent_tl, + textaccent .initial:n = \g_TUDa_color_accent_tl, + identbar .tl_gset:N = \g_TUDa_color_identbar_tl, + identbar .initial:n = \g_TUDa_color_accent_tl, + accentcolor .meta:n = {accent =#1}, + textaccentcolor .meta:n = {textaccent = #1}, + identbarcolor .meta:n = {identbar = #1}, + text .choice:, + text/preferblack .code:n = \bool_gset_false:N \g_TUDa_color_whitetext_bool, + text/preferwhite .code:n = \bool_gset_true:N \g_TUDa_color_whitetext_bool, + text .initial:n = {preferwhite}, + text/black .meta:n = {text=preferblack}, + text/white .meta:n = {text=preferwhite}, + cmyk .code:n = \PassOptionsToPackage{cmyk}{xcolor}, + RGB .code:n = \PassOptionsToPackage{RGB}{xcolor}, +} + +\ProcessKeysOptions{TUDa/colors} + +\RequirePackage{xcolor} + +\input{tudacolors.def} + +\clist_map_inline:nn {accent, textaccent, identbar} { + \cs_if_exist:cF {\string\color@\tl_use:c {g_TUDa_color_#1_tl}} { + \cs_if_exist:cT {\string\color@TUDa-\tl_use:c {g_TUDa_color_#1_tl}} { + \tl_gset:cx {g_TUDa_color_#1_tl} {TUDa-\tl_use:c {g_TUDa_color_#1_tl}} + }} +} + +\clist_const:Nn \c_TUDa_color_forbid_textaccent_clist {TUDa-0a,TUDa-5a,TUDa-6a,TUDa-6b,TUDa-7a} +\clist_const:Nn \c_TUDa_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} +\clist_const:Nn \c_TUDa_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} + + +%messages +\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.} +\msg_new:nnnn {tudacolors} {unselectable-color} {The~ color~ you~ selected~ (#1)~ must~ not~ be~ choosen~ for~ #2.} {See~ the~ Corporate~ Design~ Guidelines~ for~ further~ information.} + +%select accentcolor +\exp_args:Nnx \colorlet{accentcolor}{\g_TUDa_color_accent_tl} +\bool_if:NTF \g_TUDa_color_whitetext_bool { + \clist_if_in:NVTF \c_TUDa_color_allow_whitetext_clist \g_TUDa_color_accent_tl { + \colorlet{textonaccentcolor}{white} + } { + \colorlet{textonaccentcolor}{black} + \msg_warning:nnxx {tudacolors} {unselectable-color} {white} {textonaccentcolor} + } +} { + \clist_if_in:NVTF \c_TUDa_color_allow_blacktext_clist \g_TUDa_color_accent_tl { + \colorlet{textonaccentcolor}{black} + } { + \colorlet{textonaccentcolor}{white} + \msg_warning:nnxx {tudacolors} {unselectable-color} {black} {textonaccentcolor} + } +} + +\colorlet{identbarcolor}{\g_TUDa_color_identbar_tl} + + +\exp_args:NNx \clist_if_in:NnTF \c_TUDa_color_forbid_textaccent_clist {\g_TUDa_color_textaccent_tl} { + \msg_warning:nnxx {tudacolors} {unselectable-color} {\g_TUDa_color_textaccent_tl} {textaccentcolor} + \colorlet{textaccentcolor}{black} +} { + \colorlet{textaccentcolor}{\g_TUDa_color_textaccent_tl} +} + + +\endinput \ No newline at end of file -- cgit v1.2.3