I found a nice template for my notes but I'm having trouble getting it to reference definitions and theorems correctly, as \ref displays the section number instead of the definition number.
\documentclass{report}
\usepackage{xcolor}
\usepackage[most]{tcolorbox}
\definecolor{primary}{RGB}{60, 0, 163}
\NewDocumentCommand\caja{m O{\Large #1} O{grisfondo} O{primary} O{number within=section}}
{
\newtcbtheorem[#5]{#1}{\large #2}
{%
enhanced
,breakable
,colback = #3
,frame hidden
,boxrule = 0sp
,borderline west = {2pt}{0pt}{#4}
,sharp corners
,detach title
,before upper = \tcbtitle\par\smallskip
,coltitle = #4
,fonttitle = \bfseries\sffamily
,separator sign none
,segmentation style={solid, #4}
}
{th}
}
\caja{defi}[Definición][primary!12][primary]
\newcommand{\dfe}[2]{\begin{defi}{#1}{}#2\end{defi}}
\begin{document}
\chapter{}
\section{Section}
\section{The thing that appears in the reference}
\dfe{What I want to appear in the reference}{
This is a definition
\label{def:firstdef}
}
A reference \ref{def:firstdef} whose expected outcome is 1.2.1.
\end{document}
