Files
PrimeTeX/packages/Color.sty
Silcantar 9d072c8191 - Fix Boxout default format.
- Add colors and macros for code snippet syntax highlighting.
- Change default mono font weight back regular.
2025-09-26 23:00:27 -05:00

234 lines
6.0 KiB
TeX

\NeedsTeXFormat{LaTeX2e}
\ProvidesExplPackage{PrimeTeX/packages/Color}{2025-09-18}{1.0}{
Color definitions.
}
% Split Complementary Color Scheme
% Primary Color: Blue
% Secondary Colors: Orange, Teal
% Triadic Color Scheme
% Primary Color: Blue
% Secondary Colors: Red, Green
% Tetradic Color Schemes
% Primary Color: Blue
% Secondary Colors 1: Red, Yellow, Teal
% Secondary Colors 2: Green, Yellow, Purple
% Square Color Scheme
% Primary Color: Blue
% Secondary Colors: Yellow, Mint, Pink
% Lightness ≈ 33%
\definecolorset{HTML}{Prime}{}{% _Relationship to Base Color_
Gray, 4d505d;% #474c63 Saturation -> 9%
Yellow, 917d19;% #917d19 Complementary
Lime, 699119;% #699119 Split complementary
Green, 2d9119;% #2d9119 Triadic/Tetradic 2
Mint, 199141;% #199141 Square
Teal, 19917d;% #19917d Tetradic 1
Aqua, 196991;% #196991 Analogous
Blue, 192d91;% #192d91 *Basis of all other colors*
Violet, 411991;% #411991 Analogous
Purple, 7d1991;% #7d1991 Tetradic 2
Pink, 911969;% #911969 Square
Red, 91192d;% #91192d Triadic/Tetradic 1
Orange, 914119 % #914119 Split complementary
}
% Lightness ≈ 18%
\definecolorset{HTML}{PrimeDark}{}{% _Hue Shift_
Gray, 292b32;% #292b32 0°
Yellow, 4e430d;% #4e430d 180°
Lime, 394e0d;% #394e0d -150°
Green, 184e0d;% #184e0d -120°
Mint, 0d4e23;% #0d4e23 -90°
Teal, 0d4e43;% #0d4e43 -60°
Aqua, 0d394e;% #0d394e -30°
Blue, 0d184e;% #0d184e 0°
Violet, 220d4e;% #220d4e +30°
Purple, 430d4e;% #430d4e +60°
Pink, 4e0d39;% #4e0d39 +90°
Red, 4e0d18;% #4e0d18 +120°
Orange, 4e230d % #4e230d +150°
}
% Lightness ≈ 49%
\definecolorset{HTML}{PrimeBright}{}{%
Gray, 717588;% #717588
Yellow, d4b725;% #d4b725
Lime, 9ad425;% #9ad425
Green, 42d425;% #42d425
Mint, 25d460;% #25d460
Teal, 25d4b7;% #25d4b7
Aqua, 259ad4;% #259ad4
Blue, 2542d4;% #2542d4
Violet, 6025d4;% #6025d4
Purple, b825d4;% #b825d4
Pink, d4259a;% #d4259a
Red, d42542;% #d42542
Orange, d46025 % #d46025
}
% Lightness ≈ 64%
\definecolorset{HTML}{PrimeLight}{}{%
Gray, 9b9eac;% #9b9eac
Yellow, e4d063;% #e4d063
Lime, b8e463;% #b8e463
Green, 78e463;% #78e463
Mint, 63e48f;% #63e48f
Teal, 63e4cf;% #63e4cf
Aqua, 63b9e4;% #63b9e4
Blue, 6378e4;% #6378e4
Violet, 8f63e4;% #8f63e4
Purple, d063e4;% #d063e4
Pink, e463b8;% #e463b8
Red, e46378;% #e46378
Orange, e48f63 % #e48f63
}
% Lightness ≈ 80%
\definecolorset{HTML}{PrimePastel}{}{%
Gray, c6c8d0;% #c6c8d0
Yellow, f0e4a6;% #f0e4a6
Lime, d7f0a6;% #d7f0a6
Green, b2f0a6;% #b2f0a6
Mint, a6f0bf;% #a6f0bf
Teal, a6f0e4;% #a6f0e4
Aqua, a6d7f0;% #a6d7f0
Blue, a6b2f0;% #a6b2f0
Violet, bfa6f0;% #bfa6f0
Purple, e4a6f0;% #e4a6f0
Pink, f0a6d7;% #f0a6d7
Red, f0a6b2;% #f0a6b2
Orange, f0bfa6 % #f0bfa6
}
% Lightness ≈ 95%
\definecolorset{HTML}{PrimePale}{}{%
Gray, f1f1f3;% #f1f1f3
Yellow, fbf8e9;% #fbf8e9
Lime, f5fbe9;% #f5fbe9
Green, ecfbe9;% #ecfbe9
Mint, e9fbef;% #e9fbef
Teal, e9fbf8;% #e9fbf8
Aqua, e9f5fb;% #e9f5fb
Blue, e9ecfb;% #e9ecfb
Violet, efe9fb;% #efe9fb
Purple, f8e9fb;% #f8e9fb
Pink, fbe9f5;% #fbe9f5
Red, fbe9ec;% #fbe9ec
Orange, fbefe9 % #fbefe9
}
\bool_if:nTF {\g_dark_mode_bool && \g_electronic_bool} {
% Page and text colors.
\colorlet{pageColor}{PrimeDarkGray}
\colorlet{textColor}{PrimePastelGray}
\colorlet{captionColor}{PrimePastelBlue}
\colorlet{marginTextColor}{PrimePastelBlue}
\colorlet{linkColor}{PrimeLightBlue}
% Banded table rows.
\colorlet{bandedRowColor}{PrimeGray}
% Boxout colors.
\colorlet{boxoutBGColor}{PrimeDarkBlue}
\colorlet{boxoutFGColor}{PrimeLightBlue}
% Warning Box colors.
\colorlet{dangerBGColor}{PrimeDarkRed}
\colorlet{dangerFGColor}{PrimeRed}
\colorlet{warningBGColor}{PrimeDarkOrange}
\colorlet{warningFGColor}{PrimeOrange}
\colorlet{infoBGColor}{PrimeDarkYellow}
\colorlet{infoFGColor}{PrimeYellow}
\colorlet{tipBGColor}{PrimeDarkMint}
\colorlet{tipFGColor}{PrimeMint}
% Layout preview frame color.
\colorlet{layoutColor}{PrimeGray}
% Code snippet syntax highlighting colors.
\colorlet{codeKeywordColor}{PrimeLightBlue}
\colorlet{codeOperatorColor}{PrimeLightOrange}
\colorlet{codeCommentColor}{PrimeLightMint}
\colorlet{codeNumberColor}{PrimeLightPink}
\colorlet{codeStringColor}{PrimeLightLime}
} {
% Page and text colors.
\colorlet{pageColor}{white}
\colorlet{textColor}{black}
\colorlet{captionColor}{PrimeDarkBlue}
\colorlet{marginTextColor}{PrimeDarkBlue}
\colorlet{linkColor}{PrimeBlue}
% Banded table rows.
\colorlet{bandedRowColor}{PrimePaleGray}
% Boxout colors.
\colorlet{boxoutBGColor}{PrimePaleBlue}
\colorlet{boxoutFGColor}{PrimeBlue}
% Warning Box colors.
\colorlet{dangerBGColor}{PrimePastelRed}
\colorlet{dangerFGColor}{PrimeBrightRed}
\colorlet{warningBGColor}{PrimePastelOrange}
\colorlet{warningFGColor}{PrimeBrightOrange}
\colorlet{infoBGColor}{PrimePastelYellow}
\colorlet{infoFGColor}{PrimeBrightYellow}
\colorlet{tipBGColor}{PrimePastelMint}
\colorlet{tipFGColor}{PrimeBrightMint}
% Layout preview frame color.
\colorlet{layoutColor}{PrimePaleBlue}
% Code snippet syntax highlighting colors.
\colorlet{codeKeywordColor}{PrimeDarkBlue}
\colorlet{codeOperatorColor}{PrimeDarkOrange}
\colorlet{codeCommentColor}{PrimeDarkMint}
\colorlet{codeNumberColor}{PrimeDarkPink}
\colorlet{codeStringColor}{PrimeDarkLime}
}
\pagecolor{pageColor}
\color{textColor}
\colorlet{boxedcoloroutline}{textColor}
\NewDocumentCommand{\boxedcolor}{
% #1: Text inside box.
o
% #2: Box fill color.
m
% #3: Text Color.
O{black}
}{%
\setlength{\fboxrule}{0.0pt}% Temporarily set \fboxrule and \fboxsep.
\setlength{\fboxsep}{1.5pt}%
\IfNoValueTF{#1}{%
\def\boxedcolortext{\rule{0pt}{1ex}\rule{1ex}{0pt}}%
}{%
\def\boxedcolortext{\strut{}#1}%
}%
\fcolorbox{boxedcoloroutline}{#2}{\small\color{#3}\boxedcolortext}%
}
\NewDocumentCommand{\codekw}{m}{{\color{codeKeywordColor}#1}}
\NewDocumentCommand{\codeop}{m}{{\color{codeOperatorColor}#1}}
\NewDocumentCommand{\codecm}{m}{{\color{codeCommentColor}#1}}
\NewDocumentCommand{\codenm}{m}{{\color{codeNumberColor}#1}}
\NewDocumentCommand{\codest}{m}{{\color{codeStringColor}#1}}