改前用的是 xcolor 通用色,跟海大无关:notebox 用 NavyBlue、importantbox
用 Orange、代码关键字纯蓝 rgb(0,0,1)、注释纯绿、代码标题 violet、水印纯灰。
同一个学校两个模板的「蓝」和「红」不是一回事。
新增 cls/color.cls 作为唯一配色入口:
- 10 个基色与 幻灯片/theme/beamercolorthemeOUCSlide.sty 逐值相同
(前 7 个是官方 2021 版 VI 标准色,后 3 个是幻灯片补充的第三色)
- 8 个语义词别名(oucprimary / oucaccent / oucinfo / oucalert /
ouccaption / oucrule / ouclink / oucmuted),按语义引用而非色名,
将来调色只改一行
- 代码配色从标准色派生:关键字→海大蓝、注释→苍松绿、
字符串→海大红、类型→海大天蓝、边框→专银
各文件改为引用语义色,不再硬写 RGB:
- boxes.cls:notebox NavyBlue→oucinfo,importantbox Orange→oucalert
- code.cls:删掉本地 5 个 definecolor;bashstyle NavyBlue→oucblue;
bashoutputstyle black!10→codecolorbg + 专银线;行号 gray→oucmuted;
代码标题 violet→ouccaption
- hyperref.cls:硬写 black→ouclink
- setting.tex:水印纯灰→海大蓝 4%(原 Lightness 会强制切 gray 模型覆盖颜色,已去掉)
- report.cls:加 \input{cls/color.cls},必须有在 boxes/code 之前
有意保持中性的两处(已在注释里说明理由):
- shellbox / invertedshellbox:终端反白块语义就该是黑底,
换成蓝会变成「强调块」抢正文注意力
- 页眉线:彩色页眉线会跟正文海大蓝标题抢视觉层级,仍 0.5pt 黑
验证:错误 0,10 页,Overfull 0,Underfull 保持既有 2 条;
PDF 逐 span 提取文字色只剩 #004098 / #C81528 / #000000,
矢量填充与描边全部落在标准色内,无 NavyBlue / Orange / violet 残留。
130 lines
4.0 KiB
OpenEdge ABL
130 lines
4.0 KiB
OpenEdge ABL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||
%% code listings
|
||
%% 代码块设定
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||
\RequirePackage{listings,verbatim}
|
||
|
||
% 代码配色不在这里定义,统一来自 cls/color.cls:
|
||
% codecolorkeywords = 海大蓝 codecolorcomments = 苍松绿
|
||
% codecolorstrings = 海大红 codecolortypes = 海大天蓝
|
||
% codecolorframe = 专银 codecolorbg = 极浅中性底
|
||
|
||
\lstdefinelanguage{JavaScript}{
|
||
keywords={do, if, in, for, let, new, try, var, case, else, enum, eval, null, this, true, void, with, await, break, catch, class, const, false, super, throw, while, yield, delete, export, import, public, return, static, switch, typeof, default, extends, finally, package, private, continue, debugger, function, arguments, interface, protected, implements, instanceof},
|
||
sensitive=true,
|
||
comment=[l]{//},
|
||
morecomment=[s]{/*}{*/},
|
||
morestring=[b]',
|
||
morestring=[b]"
|
||
}
|
||
|
||
\lstdefinelanguage{TypeScript}{
|
||
keywords={abstract, break, case, catch, class, const, continue, debugger, default, delete, do, else, enum, export, extends, false, finally, for, function, if, import, in, instanceof, new, null, return, super, switch, this, throw, true, try, typeof, var, void, while, with, as, implements, interface, let, package, private, protected, public, static, yield, any, boolean, constructor, declare, get, module, require, number, set, string, symbol, type, from, of},
|
||
sensitive=true,
|
||
comment=[l]{//},
|
||
morecomment=[s]{/*}{*/},
|
||
morestring=[b]',
|
||
morestring=[b]"
|
||
}
|
||
|
||
\lstdefinelanguage{golang}{
|
||
keywords={break, default, func, interface, select, case, defer, go, map, struct, chan, else, goto, package, switch, const, fallthrough, if, range, type, continue, for, import, return, var},
|
||
sensitive=true,
|
||
comment=[l]{//},
|
||
morecomment=[s]{/*}{*/},
|
||
morestring=[b]',
|
||
morestring=[b]"
|
||
}
|
||
|
||
\lstdefinestyle{mystyle}{
|
||
% Basic design
|
||
basicstyle=\linespread{1.2}\ttfamily,
|
||
frame=tb,
|
||
framesep=5pt,
|
||
framerule=.5pt,
|
||
framexleftmargin=10pt,
|
||
rulecolor=\color{codecolorframe},
|
||
abovecaptionskip=0pt,
|
||
belowcaptionskip=5pt,
|
||
aboveskip=5pt,
|
||
backgroundcolor=\color{codecolorbg},
|
||
% Code design
|
||
keywordstyle=\color{codecolorkeywords},
|
||
commentstyle=\color{codecolorcomments},
|
||
stringstyle=\color{codecolorstrings},
|
||
numberstyle=\small\color{oucmuted},
|
||
breakatwhitespace=false,
|
||
breaklines=true,
|
||
captionpos=t,
|
||
keepspaces=true,
|
||
% Line numbers
|
||
numbers=none,
|
||
numbersep=15pt,
|
||
xleftmargin=10pt,
|
||
stepnumber=1,
|
||
firstnumber=1,
|
||
numberfirstline=true,
|
||
% Code
|
||
tabsize=4,
|
||
showspaces=false,
|
||
showstringspaces=false,
|
||
showtabs=false,
|
||
breaklines=true,
|
||
}
|
||
\lstset{style=mystyle}
|
||
|
||
%% 命令行(bash 示例):浅海大蓝底 + 粗左侧海大蓝竖线
|
||
\lstdefinestyle{bashstyle}{
|
||
backgroundcolor=\color{oucblue!10!white},
|
||
basicstyle=\linespread{1.2}\ttfamily,
|
||
keepspaces=true,
|
||
numbers=none,
|
||
numbersep=10pt,
|
||
frame=l,
|
||
framerule=2pt,
|
||
framesep=5pt,
|
||
framexleftmargin=3pt,
|
||
framextopmargin=-5pt,
|
||
xleftmargin=10pt,
|
||
rulecolor=\color{oucblue},
|
||
% Code
|
||
tabsize=4,
|
||
showspaces=false,
|
||
showstringspaces=false,
|
||
showtabs=false,
|
||
breaklines=true,
|
||
}
|
||
|
||
%% 命令行输出:中性极浅底 + 专银左侧竖线
|
||
% 说明:输出是"机器吐出来的东西",语义上不该比命令更醒目,
|
||
% 所以颜色比 bashstyle 退一档,用专银而不是海大蓝。
|
||
\lstdefinestyle{bashoutputstyle}{
|
||
backgroundcolor=\color{codecolorbg},
|
||
basicstyle=\linespread{1.2}\ttfamily,
|
||
keepspaces=true,
|
||
numbers=none,
|
||
numbersep=10pt,
|
||
frame=l,
|
||
framerule=2pt,
|
||
framesep=5pt,
|
||
framexleftmargin=3pt,
|
||
framextopmargin=-5pt,
|
||
xleftmargin=10pt,
|
||
rulecolor=\color{codecolorframe},
|
||
% Code
|
||
tabsize=4,
|
||
showspaces=false,
|
||
showstringspaces=false,
|
||
showtabs=false,
|
||
breaklines=true,
|
||
}
|
||
|
||
%% 代码列表标题
|
||
\RequirePackage{caption}
|
||
\DeclareCaptionFormat{codecaptionformat}{%
|
||
%%\colorbox{black!20}{
|
||
%% \parbox{\textwidth}{#1#2\ttfamily#3}
|
||
%%}
|
||
\parbox{\textwidth}{\textcolor{ouccaption}\faCode~\textcolor{ouccaption}{#1#2}\hspace{.5em}\fzkai#3}
|
||
}
|
||
\captionsetup[lstlisting]{format=codecaptionformat} |