summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bfh-ci/bfh-layout-terminal.cfg
blob: 1d7f134f4d4519797c2da8b39306608d112d852e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
%% This is file `bfh-layout-tabular.cfg' version 2.2.1 (2024-03-11),
%% it is part of
%% BFH-CI -- Corporate Design for Bern University of Applied Sciences
%% ----------------------------------------------------------------------------
%%
%%  Copyright (C) 2021–2024 by
%%      Marei Peischl <marei@peitex.de>
%%      Andreas Habegger <andreas.habegger@bfh.ch>
%%
%% ============================================================================
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% 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.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainers of this work are
%%   Marei Peischl <bfh-ci@peitex.de>
%%   Andreas Habegger <andreas.habegger@bfh.ch>
%%
%% The development respository can be found at
%% https://gitlab.ti.bfh.ch/bfh-latex/bfh-ci/
%% Please use the issue tracker for feedback!
%%
%% ============================================================================
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bfh-layout-terminal.cfg}[2024-03-11 v2.2.1 terminal configuration for bfhlayout]

\RequirePackage{bfhcolors}
\RequirePackage{tcolorbox}
\RequirePackage{url}

\tcbuselibrary{skins,xparse,listings}

\colorlet{ubuntu-terminalBackground}{violet!50!black}
\colorlet{ubuntu-terminalText}{white}
\colorlet{ubuntu-terminalFrame}{gray!65!black}
\colorlet{ubuntu-terminalFirstBullet}{orange}
\colorlet{ubuntu-terminalSecondBullet}{gray}
\colorlet{ubuntu-terminalThirdBullet}{gray}

%define key because we receive an error for setting them in case minted isn't loaded
\csname @ifpackageloaded\endcsname{minted}{}{
	\tcbset{minted options/.style={}}
}



\tcbset{
	ptxcd/terminal/default/.style={
		listing only,
		listing options={style=tcblatex,language=sh,escapeinside=``,},
	  listing inputencoding=utf8,
	  minted options={escapeinside=\\`\\`,autogobble,formatcom=\BFHterminalFormatLine,breaklines,breaksymbol=\quad},
	  every listing line={\BFHterminalPrompt{}},
	  size=small,
	  halign title=flush left,
	},
	ptxcd/terminal/macos/.style={
	  colback=macosx-terminalBackground,
		colupper=macosx-terminalText,
		colframe=macosx-terminalFrame,
		title={\textcolor{macosx-terminalFirstBullet}{\huge\ttfamily\bfseries{$\bullet$}\textcolor{macosx-terminalSecondBullet}{\huge\ttfamily\bfseries{$\bullet$}\textcolor{macosx-terminalThirdBullet}{\huge\ttfamily\bfseries{$\bullet$}}}}},
	},
	ptxcd/terminal/ubuntu/.style={
	  colback=ubuntu-terminalBackground,
		colupper=ubuntu-terminalText,
		colframe=ubuntu-terminalFrame,
		title={\textcolor{ubuntu-terminalFirstBullet}{\huge{$\bullet$}}{\textcolor{ubuntu-terminalSecondBullet}{\huge{$\bullet$}}}{\textcolor{ubuntu-terminalThirdBullet}{\huge{$\bullet$}}}},
	}
}


\newcommand{\BFHterminalFormatLine}{%
	\def\FancyVerbFormatLine##1{\BFHterminalPrompt{}##1}%
}

\newtcblisting{ubuntu}{
	ptxcd/terminal/default,
	ptxcd/terminal/ubuntu
}

\newtcblisting{ubuntu*}[1]{
	ptxcd/terminal/default,
	ptxcd/terminal/ubuntu,
	#1
}

\newcommand{\setupLinuxPrompt}[1]{\pgfkeys{/terminal/.cd,host=ubuntu,#1}%
  \gdef\BFHterminalPrompt{\textcolor{\TerminalColor}{\small\ttfamily\bfseries \TerminalUser\url{@}\TerminalHost{\textcolor{ubuntu-terminalText}:}\textcolor{ubuntu-terminalText}{\url{~}}{\textcolor{ubuntu-terminalText}\TerminalPromptChar}\,}}
  \lstset{backgroundcolor=}
  \lstset{frame=}
  \lstset{numberstyle=}
  \lstset{numbers=none}
} %%tabular

\colorlet{macosx-terminalBackground}{white}
\colorlet{macosx-terminalText}{black}
\colorlet{macosx-terminalFrame}{gray!25}
\colorlet{macosx-terminalFirstBullet}{red!65}
\colorlet{macosx-terminalSecondBullet}{orange!52!yellow}
\colorlet{macosx-terminalThirdBullet}{green!80!black}

\newtcblisting{macos}{
	ptxcd/terminal/default,
	ptxcd/terminal/macos
}

\newtcblisting{macos*}[1]{
	ptxcd/terminal/default,
	ptxcd/terminal/macos,
	#1
}

\newcommand{\setupOSXPrompt}[1]{\pgfkeys{/terminal/.cd,host=macintosh,#1}%
  \gdef\BFHterminalPrompt{\textcolor{\TerminalColor}{\small\ttfamily\bfseries \TerminalUser\url{@}\TerminalHost{\textcolor{macosx-terminalText}:}\textcolor{macosx-terminalText}{\url{~}}{\textcolor{macosx-terminalText}\TerminalPromptChar}\,}}
  \lstset{backgroundcolor=}
  \lstset{frame=}
  \lstset{numberstyle=}
  \lstset{numbers=none}
} %%


\pgfkeys{
  /terminal/.cd,
  user/.code={\gdef\TerminalUser{#1}},user={},
  host/.code={\gdef\TerminalHost{#1}},host={},
  color/.code={\gdef\TerminalColor{#1}},color=white,
  prompt char/.code={\gdef\TerminalPromptChar{#1}},
  prompt char=\$,
  root/.style={user=root,color=BFH-MediumRed,prompt char=\#},
  student/.style={user=student,color=BFH-LightGreen,prompt char=\$},
  remote/.style={user=user,host=remotehost,color=BFH-LightPurple,prompt char=\$},
} %%

\newcommand{\StartConsole}{\gdef\BFHterminalPrompt{}}

\endinput