\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Color}[2025-07-09]

\RequirePackage{ifthen}

% Color import and definition
\RequirePackage{xcolor}

\definecolorset{HTML}{Prime}{}{%
	Gray,	4d505d;% #4d505d	Blue, saturation -> 10%
	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
}

% Lightness ≈ 18%
\definecolorset{HTML}{PrimeDark}{}{%
	Gray,	292b32;% #292b32
	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
}

% Lightness ≈ 49%
\definecolorset{HTML}{PrimeBright}{}{%
	Gray,	727587;% #727587
	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
}

% Lightness ≈ 64%
\definecolorset{HTML}{PrimeLight}{}{%
	Gray,	9b9eac;% #9b9eac
	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,	c6c8d0;% #c6c8d0
	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,	f0f1f4;% #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.0pt}% Temporarily set \fboxrule and \fboxsep.
	\setlength{\fboxsep}{1.5pt}%
	\fcolorbox{boxedcoloroutline}{#2}{\color{#3}\strut{}#1}%
}