From fc3e8e2575e29c18f05f3bde0e95b462d853662f Mon Sep 17 00:00:00 2001 From: Joshua Lucas Date: Fri, 29 Aug 2025 12:56:36 -0500 Subject: [PATCH] Expand and harmonize color sets. --- commonincludes.def | 8 +- packages/Boxout.sty | 22 ++--- packages/Caption.sty | 2 +- packages/Color.sty | 173 +++++++++++++++++++++++++++++++++------- packages/Layout.sty | 27 ++++--- packages/Links.sty | 4 +- packages/Marginalia.sty | 7 +- packages/Tables.sty | 6 +- packages/Titles.sty | 10 +++ 9 files changed, 188 insertions(+), 71 deletions(-) diff --git a/commonincludes.def b/commonincludes.def index 8470a57..9199634 100644 --- a/commonincludes.def +++ b/commonincludes.def @@ -2,17 +2,13 @@ \RequirePackage{PrimeTeX/packages/Caption} -\ifthenelse{\boolean{isDarkMode}\AND\boolean{isElectronic}}{ - \RequirePackage[darkmode]{PrimeTeX/packages/Color} -}{ - \RequirePackage{PrimeTeX/packages/Color} -} +\RequirePackage{PrimeTeX/packages/Color} \RequirePackage{PrimeTeX/packages/CrossRef} \RequirePackage{PrimeTeX/packages/DocProperties} -% Load graphicx before Fonts because the menukeys packages causes a conflict. +% Load graphicx before Fonts because the menukeys package causes a conflict. % Graphics package for including images \RequirePackage[final]{graphicx} diff --git a/packages/Boxout.sty b/packages/Boxout.sty index e2cc9c1..80f1490 100644 --- a/packages/Boxout.sty +++ b/packages/Boxout.sty @@ -9,24 +9,18 @@ \providelength{\boxoutpadding}[1em] \providelength{\boxoutrule}[1pt] -\colorlet{BoxoutBGColor}{PrimePaleBlue} -\colorlet{BoxoutFGColor}{PrimeBlue} - -\definecolor{WarningBoxBGColor}{RGB}{255, 221, 118} -\definecolor{WarningBoxFGColor}{RGB}{255, 150, 0} - \NewTblrEnviron{tblrBoxout} \SetTblrInner[tblrBoxout]{ - cells = {BoxoutBGColor}, + cells = {boxoutBG}, hborder{1} = {belowspace=\boxoutpadding}, hborder{Z} = {abovespace=\boxoutpadding}, - hlines = {0pt,BoxoutBGColor}, - hline{1,Z} = {\boxoutrule,BoxoutFGColor}, + hlines = {0pt,boxoutBG}, + hline{1,Z} = {\boxoutrule,boxoutFG}, %row{1} = {font={\bfseries\sbfamily}}, vborder{1} = {rightspace=\boxoutpadding}, vborder{Z} = {leftspace=\boxoutpadding}, - vlines = {0pt,BoxoutBGColor}, - vline{1,Z} = {\boxoutrule,BoxoutFGColor}, + vlines = {0pt,boxoutBG}, + vline{1,Z} = {\boxoutrule,boxoutFG}, } \NewDocumentEnvironment{@boxout}{ @@ -51,8 +45,8 @@ +b }{% \ifthenelse{\equal{#4}{w}\OR\equal{#4}{W}}{% - \colorlet{BoxoutBGColor}{WarningBoxBGColor}% - \colorlet{BoxoutFGColor}{WarningBoxFGColor}% + \colorlet{boxoutBG}{warningBG}% + \colorlet{boxoutFG}{warningFG}% }{}% \IfBlankTF{#3}{% \begin{@boxout}{#1}{#2}{}% @@ -101,7 +95,7 @@ \NewDocumentEnvironment{WrapBoxout}{ % position [l,r,i,o] - O{O} + O{o} % offset O{\marparwidth} % width diff --git a/packages/Caption.sty b/packages/Caption.sty index bbcd872..86fe54c 100644 --- a/packages/Caption.sty +++ b/packages/Caption.sty @@ -8,7 +8,7 @@ justification = Centering, font = { small, - color=PrimeBlue, + color=caption, }, } diff --git a/packages/Color.sty b/packages/Color.sty index fdd9f46..0cc3a02 100644 --- a/packages/Color.sty +++ b/packages/Color.sty @@ -3,44 +3,155 @@ \RequirePackage{ifthen} -\newboolean{colorIsDarkMode} -\setboolean{colorIsDarkMode}{false} - -\DeclareOption{darkmode}{ - \setboolean{colorIsDarkMode}{true} -} -\ProcessOptions\relax - % Color import and definition \RequirePackage{xcolor} -\ifthenelse{\boolean{colorIsDarkMode}}{ - \pagecolor[rgb]{0.2,0.2,0.2} - \color[rgb]{0.9,0.9,0.9} - - \definecolor{PrimeBlue}{RGB}{149, 164, 237} - \definecolor{PrimePaleBlue}{RGB}{35, 39, 56} - - \definecolor{pageColor}{rgb}{0.2,0.2,0.2} - \definecolor{textColor}{rgb}{0.9,0.9,0.9} - \definecolor{paleGray}{rgb}{0.3,0.3,0.3} -}{ - \definecolor{PrimeBlue}{RGB}{25,45,145} - \definecolor{PrimePaleBlue}{RGB}{233,236,251} - - \colorlet{pageColor}{white} - \colorlet{textColor}{black} - \colorlet{paleGray}{gray!10} +\definecolorset{HTML}{Prime}{}{% + Gray, 474c63;% #474c63 Blue, saturation -> 17% + Red, 91192d;% #91192d Tetradic + Orange, 914119;% #914119 Split complementary + Yellow, 917d19;% #917d19 Complementary + Lime, 699119;% #699119 Split complementary + Green, 2d9119;% #2d9119 Triadic + Teal, 19917d;% #19917d Tetradic + Aqua, 196991;% #196991 Analogous + Blue, 192d91;% #192d91 Basis of all other colors + Purple, 411991;% #411991 Analogous + Pink, 911969 % #911969 Analogous of Red & Purple } -\colorlet{layoutColor}{PrimePaleBlue} +% Lightness ≈ 18% +\definecolorset{HTML}{PrimeDark}{}{% + Gray, 262836;% #262836 + Red, 4e0d18;% #4e0d18 + Orange, 4e230d;% #4e230d + Yellow, 4e430d;% #4e430d + Lime, 394e0d;% #394e0d + Green, 184e0d;% #184e0d + Teal, 0d4e43;% #0d4e43 + Aqua, 0d394e;% #0d394e + Blue, 0d184e;% #0d184e + Purple, 220d4e;% #220d4e + Pink, 4e0d39 % #4e0d39 +} -\RequirePackage{PrimeTeX/packages/Layout} +% Lightness ≈ 49% +\definecolorset{HTML}{PrimeBright}{}{% + Gray, 686f91;% #686f91 + Red, d42542;% #d42542 + Orange, d46025;% #d46025 + Yellow, d4b725;% #d4b725 + Lime, 9ad425;% #9ad425 + Green, 42d425;% #42d425 + Teal, 25d4b7;% #25d4b7 + Aqua, 259ad4;% #259ad4 + Blue, 2542d4;% #2542d4 + Purple, 6025d4;% #6025d4 + Pink, d4259a % #d4259a +} -\colorlet{boxedcoloroutline}{black} +% Lightness ≈ 64% +\definecolorset{HTML}{PrimeLight}{}{% + Gray, 9499b3;% #9499b3 + Red, e46378;% #e46378 + Orange, e48f63;% #e48f63 + Yellow, e4d063;% #e4d063 + Lime, b8e463;% #b8e463 + Green, 63e48f;% #63e48f + Teal, 63b8e4;% #63b8e4 + Aqua, 63b9e4;% #63b9e4 + Blue, 6378e4;% #6378e4 + Purple, 8f63e4;% #8f63e4 + Pink, e463b8 % #e463b8 +} + +% Lightness ≈ 64% +\definecolorset{HTML}{PrimePastel}{}{% + Gray, c2c5d4;% #c2c5d4 + Red, f0a6b2;% #f0a6b2 + Orange, f0bfa6;% #f0bfa6 + Yellow, f0e4a6;% #f0e4a6 + Lime, d7f0a6;% #d7f0a6 + Green, b2f0a6;% #b2f0a6 + Teal, a6f0e4;% #a6f0e4 + Aqua, a6d7f0;% #a6d7f0 + Blue, a6b2f0;% #a6b2f0 + Purple, bfa6f0;% #bfa6f0 + Pink, f0a6d7 % #f0a6d7 +} + +% Lightness ≈ 95% +\definecolorset{HTML}{PrimePale}{}{% + Gray, eff0f5;% #eff0f5 + Red, fbe9ec;% #fbe9ec + Orange, fbefe9;% #fbefe9 + Yellow, fbf8e9;% #fbf8e9 + Lime, f5fbe9;% #f5fbe9 + Green, ecfbe9;% #ecfbe9 + Teal, e9fbf8;% #e9fbf8 + Aqua, e9f5fb;% #e9f5fb + Blue, e9ecfb;% #e9ecfb + Purple, efe9fb;% #efe9fb + Pink, fbe9f5 % #fbe9f5 +} + +\ifthenelse{\boolean{isDarkMode}\AND\boolean{isElectronic}}{ + % Page and text colors. + \colorlet{page}{PrimeDarkGray} + \colorlet{text}{PrimePastelGray} + + \colorlet{caption}{PrimePastelBlue} + + \colorlet{marginText}{PrimePastelBlue} + + \colorlet{link}{PrimeLightBlue} + + % Banded table rows. + \colorlet{bandedRow}{PrimeGray} + + % Boxout colors. + \colorlet{boxoutBG}{PrimeDarkBlue} + \colorlet{boxoutFG}{PrimeLightBlue} + + % Warning Box colors. + \colorlet{warningBG}{PrimeDarkOrange} + \colorlet{warningFG}{PrimeOrange} + + % Layout preview frame color. + \colorlet{layout}{PrimeGray} +}{ + % Page and text colors. + \colorlet{page}{white} + \colorlet{text}{black} + + \colorlet{caption}{PrimeDarkBlue} + + \colorlet{marginText}{PrimeDarkBlue} + + \colorlet{link}{PrimeBlue} + + % Banded table rows. + \colorlet{bandedRow}{PrimePaleGray} + + % Boxout colors. + \colorlet{boxoutBG}{PrimePaleBlue} + \colorlet{boxoutFG}{PrimeBlue} + + % Warning Box colors. + \colorlet{warningBG}{PrimePastelOrange} + \colorlet{warningFG}{PrimeBrightOrange} + + % Layout preview frame color. + \colorlet{layout}{PrimePaleBlue} +} + +\pagecolor{page} +\color{text} + +\colorlet{boxedcoloroutline}{text} \NewDocumentCommand{\boxedcolor}{O{\rule{0pt}{1ex}\rule{1ex}{0pt}} m m}{% - {\setlength{\fboxrule}{0.2pt}% Temporarily set \fboxrule and \fboxsep. - \setlength{\fboxsep}{1pt}% - \fcolorbox{boxedcoloroutline}{#2}{\color{#3}\strut{}#1}}% + \setlength{\fboxrule}{0.0pt}% Temporarily set \fboxrule and \fboxsep. + \setlength{\fboxsep}{1.5pt}% + \fcolorbox{boxedcoloroutline}{#2}{\color{#3}\strut{}#1}% } \ No newline at end of file diff --git a/packages/Layout.sty b/packages/Layout.sty index b7f3277..c6374c8 100644 --- a/packages/Layout.sty +++ b/packages/Layout.sty @@ -34,20 +34,21 @@ % Redefine the commands geometry uses to draw the page frame to customize the % color. -\renewcommand{\Gm@vrule}{\color{layoutColor}\vrule width 0.2pt height\textheight depth\z@} -\renewcommand{\Gm@hrule}{\color{layoutColor}\hrule height 0.2pt depth\z@ width\textwidth} -\renewcommand{\Gm@hruled}{\color{layoutColor}\hrule height\z@ depth0.2pt width\textwidth} +\renewcommand{\Gm@vrule}{\color{layout}\vrule width 0.2pt height\textheight depth\z@} +\renewcommand{\Gm@hrule}{\color{layout}\hrule height 0.2pt depth\z@ width\textwidth} +\renewcommand{\Gm@hruled}{\color{layout}\hrule height\z@ depth0.2pt width\textwidth} % Suppress "Underfull \hbox" infos. \hbadness=10000 \ifthenelse{\boolean{isDraft}}{ \geometry{showframe} - \hfuzz = 2.0pt + \hfuzz = 0.5pt + \vfuzz = 0.0pt }{ % Suppress small overfull infos. \hfuzz = 6.0pt - \vfuzz = 0.0pt + \vfuzz = 8.0pt } \ifthenelse{\boolean{isElectronic}}{ @@ -63,15 +64,23 @@ \providelength{\contentwidth}[\textwidth + \marparwidth] \RequirePackage[ + debug, balanced, + emergencystretch = 3em, + max-cost = 25000, + widowpenalty = 1000, + orphanpenalty = 1000, + brokenpenalty = 10000, + nobreak = keep, ]{lua-widow-control} + \ifthenelse{\boolean{isDraft}}{ - \lwcsetup{draft=false,showcolours=true} + \lwcsetup{showcolours=true,} }{} % Paragraph formatting. \setlength{\parindent}{0pt} -\setlength{\parskip}{\medskipamount} +\setlength{\parskip}{6pt plus 3pt minus 3pt} % Float Page Configuration \renewcommand{\topfraction}{0.9} % max fraction of floats at top @@ -130,9 +139,9 @@ \begin{SmartAdjustWidth}{-#2}{-#2 * \real{#4}}% adjustwidth(*) \begin{minipage}{\linewidth}%{#2 * (#4 + 1) + \textwidth}% \ifthenelse{\boolean{isDraft}}{% - {\color{layoutColor}\rule{\textwidth}{1pt}\zws}% + {\color{layout}\rule{\textwidth}{1pt}\zws}% #5% - %{\color{layoutColor}\rule{\textwidth}{1pt}}% + %{\color{layout}\rule{\textwidth}{1pt}}% }{% #5% }% diff --git a/packages/Links.sty b/packages/Links.sty index 1c69228..dcb97d8 100644 --- a/packages/Links.sty +++ b/packages/Links.sty @@ -16,11 +16,11 @@ \ifthenelse{\boolean{isElectronic}}{ \hypersetup{ - allcolors = PrimeBlue, + allcolors = link, } }{ \hypersetup{ - allcolors = textColor, + allcolors = text, pdfduplex = DuplexFlipLongEdge, pdfpagelayout = TwoPageRight, } diff --git a/packages/Marginalia.sty b/packages/Marginalia.sty index fef39a7..d48d658 100644 --- a/packages/Marginalia.sty +++ b/packages/Marginalia.sty @@ -1,9 +1,6 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{PrimeTeX/packages/Marginalia}[2025-07-09] -% Marginalia formatting. -\colorlet{marginTextColor}{PrimeBlue} - % Allow hyphenation in narrow margin paragraphs. \RequirePackage{ragged2e} @@ -20,8 +17,8 @@ - \textheight }, yshift = {7pt}, % Just a magic number that lines up margin notes with their reference. - style recto outer = {\RaggedRight\small\color{marginTextColor}}, - style verso outer = {\RaggedLeft\small\color{marginTextColor}}, + style recto outer = {\RaggedRight\small\color{marginText}}, + style verso outer = {\RaggedLeft\small\color{marginText}}, } % Put a glossary definition in a margin paragraph. diff --git a/packages/Tables.sty b/packages/Tables.sty index c201dd9..b7ed9f0 100644 --- a/packages/Tables.sty +++ b/packages/Tables.sty @@ -22,13 +22,13 @@ \NewTblrEnviron{tblrBanded} \SetTblrInner[tblrBanded]{ rowhead = 1, - row{odd} = {paleGray}, - row{1} = {bg=pageColor, font=\bfseries}, + row{odd} = {bandedRow}, + row{1} = {bg=page, font=\bfseries}, hline{1,Z} = {0.6pt}, hline{2} = {0.4pt}, } -\NewTblrTableCommand{\midtitle}[1][pageColor]{ +\NewTblrTableCommand{\midtitle}[1][page]{ \SetCell[c=2]{ c, bg = #1, diff --git a/packages/Titles.sty b/packages/Titles.sty index f26daff..efbeb6b 100644 --- a/packages/Titles.sty +++ b/packages/Titles.sty @@ -19,8 +19,18 @@ \chaptertitlename{} \thechapter }{20pt}{\Huge} +\titlespacing{\chapter}{0pt}{36pt plus 12pt minus 12pt}{24pt plus 8pt minus 8pt} + \titleformat*{\section}{\sbfamily\Large} + +\titlespacing{\section}{0pt}{16pt plus 5pt minus 5pt}{14pt plus 4pt minus 4pt} + \titleformat*{\subsection}{\sbfamily\large} + +\titlespacing{\subsection}{0pt}{14pt plus 4pt minus 4pt}{12pt plus 4pt minus 4pt} + \titleformat*{\subsubsection}{\sbfamily} + \titleformat*{\paragraph}{\sbfamily} + \titleformat*{\subparagraph}{\sbfamily}