%% Copyright (c) 2025 mangalbhaskar. All Rights Reserved. %% __author__ = 'mangalbhaskar' %% ---------------------------------------------------------- %% ktbox for prompt and genai reponse styling %% ---------------------------------------------------------- \ProvidesPackage{ktbox}[2025/05/29 v0.0.1 KTBox framework prompt-response styling] %% Load colors first to avoid xcolor clashes \RequirePackage{ktcolor} %% Core deps \RequirePackage[most]{tcolorbox} \RequirePackage{enumitem} % because you’re calling \setlist %% Theme resolver \tcbset{ theme/.style={ %% Light mode themes blue/.style={colback=ktblue-bg, colframe=ktblue-border, coltitle=ktblue-title, colbacktitle=ktblue-titlebox}, green/.style={colback=ktgreen-bg, colframe=ktgreen-border, coltitle=ktgreen-title, colbacktitle=ktgreen-titlebox}, yellow/.style={colback=ktyellow-bg, colframe=ktyellow-border, coltitle=ktyellow-title, colbacktitle=ktyellow-titlebox}, orange/.style={colback=ktorange-bg, colframe=ktorange-border, coltitle=ktorange-title, colbacktitle=ktorange-titlebox}, red/.style={colback=ktred-bg, colframe=ktred-border, coltitle=ktred-title, colbacktitle=ktred-titlebox}, gray/.style={colback=ktgray-bg, colframe=ktgray-border, coltitle=ktgray-title, colbacktitle=ktgray-titlebox}, magenta/.style={colback=ktmagenta-bg, colframe=ktmagenta-border, coltitle=ktmagenta-title, colbacktitle=ktmagenta-titlebox}, purple/.style={colback=ktpurple-bg, colframe=ktpurple-border, coltitle=ktpurple-title, colbacktitle=ktpurple-titlebox}, cyan/.style={colback=ktcyan-bg, colframe=ktcyan-border, coltitle=ktcyan-title, colbacktitle=ktcyan-titlebox}, white/.style={colback=ktwhite-bg, colframe=ktwhite-border, coltitle=ktwhite-title, colbacktitle=ktwhite-titlebox}, %% Dark mode themes blue-dark/.style={colback=ktblue-bg-dark, colframe=ktblue-border-dark, coltitle=ktblue-title-dark, coltext=ktblue-text-dark, colbacktitle=ktblue-titlebox-dark}, green-dark/.style={colback=ktgreen-bg-dark, colframe=ktgreen-border-dark, coltitle=ktgreen-title-dark, coltext=ktgreen-text-dark, colbacktitle=ktgreen-titlebox-dark}, yellow-dark/.style={colback=ktyellow-bg-dark, colframe=ktyellow-border-dark, coltitle=ktyellow-title-dark, coltext=ktyellow-text-dark, colbacktitle=ktyellow-titlebox-dark}, orange-dark/.style={colback=ktorange-bg-dark, colframe=ktorange-border-dark, coltitle=ktorange-title-dark, coltext=ktorange-text-dark, colbacktitle=ktorange-titlebox-dark}, red-dark/.style={colback=ktred-bg-dark, colframe=ktred-border-dark, coltitle=ktred-title-dark, coltext=ktred-text-dark, colbacktitle=ktred-titlebox-dark}, gray-dark/.style={colback=ktgray-bg-dark, colframe=ktgray-border-dark, coltitle=ktgray-title-dark, coltext=ktgray-text-dark, colbacktitle=ktgray-titlebox-dark}, magenta-dark/.style={colback=ktmagenta-bg-dark, colframe=ktmagenta-border-dark, coltitle=ktmagenta-title-dark, coltext=ktmagenta-text-dark, colbacktitle=ktmagenta-titlebox-dark}, purple-dark/.style={colback=ktpurple-bg-dark, colframe=ktpurple-border-dark, coltitle=ktpurple-title-dark, coltext=ktpurple-text-dark, colbacktitle=ktpurple-titlebox-dark}, cyan-dark/.style={colback=ktcyan-bg-dark, colframe=ktcyan-border-dark, coltitle=ktcyan-title-dark, coltext=ktcyan-text-dark, colbacktitle=ktcyan-titlebox-dark}, white-dark/.style={colback=ktwhite-bg-dark, colframe=ktwhite-border-dark, coltitle=ktwhite-title-dark, coltext=ktwhite-text-dark, colbacktitle=ktwhite-titlebox-dark}, %% Evaluate the value and apply the matched style #1 } } %% Key Takeaway: Auto-Numbered Title Box \newtcolorbox[auto counter, number within=section]{ktboxnumbered}[2][]{% enhanced, breakable, theme, parbox=false, % sharp corners, colback=gray!2!blue!3, colframe=blue!30!black, coltitle=black, colbacktitle=blue!10, fonttitle=\bfseries, title=Key Takeaway~\thetcbcounter~#2, boxed title style={ boxrule=0.4pt, arc=0.5mm, % sharp corners, top=2pt, bottom=2pt, left=4pt, right=4pt, }, attach boxed title to top left={yshift=-1.5mm, xshift=2mm}, % << adjust vertical bump boxrule=0.3pt, left=6pt, right=6pt, top=6pt, %% << reduce if needed bottom=5pt, before skip=12pt, %% << add spacing before box after skip=8pt, before upper={% \setlength{\leftskip}{0pt}% \setlength{\parindent}{-2pt}% \setlength{\leftmargini}{16pt}% \setlist[itemize]{left=0.2em, itemsep=1pt, topsep=1pt, partopsep=0pt}% }, #1 } %% Helper to extract dynamic theme values into title box \tcbset{ ktbubble/.style={ boxed title style={ boxrule=0.4pt, arc=0.5mm, top=2pt, bottom=2pt, left=4pt, right=4pt, }, attach boxed title to top left={yshift=-2mm, xshift=2mm}, } } %% ktbox \newtcolorbox{ktbox}[1][]{% enhanced, breakable, theme, ktbubble, % ← only here parbox=false, colback=gray!2!blue!3, colframe=blue!30!black, coltitle=black, colbacktitle=blue!10, fonttitle=\bfseries, title={}, % allow [title=...] to work boxrule=0.3pt, left=6pt, right=6pt, top=10pt, bottom=5pt, before skip=12pt, after skip=6pt, before={\par\noindent}, before upper={% \setlength{\leftskip}{0pt}% \setlength{\parindent}{-2pt}% \setlength{\leftmargini}{16pt}% \setlist[itemize]{left=0.2em, itemsep=1pt, topsep=1pt, partopsep=0pt}% }, #1 } %% ktboxwide \newtcolorbox{ktboxwide}[1][]{% enhanced, breakable, theme, parbox=false, % sharp corners, colback=gray!2!blue!3, colframe=blue!30!black, coltitle=black, colbacktitle=blue!10, fonttitle=\bfseries, title={}, boxrule=0.3pt, arc=0.5mm, left=2pt, right=2pt, top=1pt, bottom=1pt, before skip=6pt, after skip=6pt, before upper={% \setlength{\leftskip}{0pt}% \setlength{\parindent}{0pt}% \setlength{\leftmargini}{0pt}% \setlist[itemize]{left=0.2em, itemsep=1pt, topsep=1pt, partopsep=0pt}% }, #1 }