I'm trying to create a generic command to write a solid heading. The width of the heading should fit into the containing environment in which the heading it rendered.
In the example below, the orange heading flows outside the table.
What command should I use to replace \textwidthin the solidheading so that it will always print a width that fits into either a paragraph width or inside a table column?
The code to produce this is as follows:
\documentclass[12pt]{article}
\usepackage{xcolor}
\newcommand{\solidheading}[2][yellow]{
\noindent \colorbox{#1}{\parbox[t]{\textwidth}{#2}}
\vskip1ex
}
\usepackage{colortbl}
\usepackage{fontawesome5}
\newenvironment{notes}
{ \noindent
\begin{tabular}{!{\color{black}\vrule width 0.01\textwidth}p{0.85\textwidth}}
{\cellcolor{gray}}
{\Large\faEdit[regular]} \bfseries{Notes}\\
{\cellcolor{lightgray}}
}
{
\end{tabular}
}
\begin{document}
\solidheading[pink]{Heading outside Table}
\begin{notes}
\solidheading[orange]{Don't forget}
Smile and say hello.\newline
Happy makes happy.
\end{notes}
\end{document}

