Align shaded box to top of page

framed

I have a page that has a shaded box at the top. How do I get the shaded box to align with the top of the page frame? There's a bit of a gap. My code:

\documentclass[10pt]{book}
\usepackage[showframe]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{framed}
\colorlet{shadecolor}{LavenderBlush2}
\usepackage{lipsum}
\begin{document}
\setlength{\OuterFrameSep}{0pt}
\begin{shaded*}
\lipsum[1]
\end{shaded*}
\vfill
\begin{shaded*}
\lipsum[1]
\end{shaded*}
\end{document}

results in
enter image description here

In another question (Align shaded box to bottom of page), it has been suggested to set OuterFrameSep to 0 in order to remove the vertical space before and after the framed environment. That does seem to work for after the framed environment, but not before.

Best Answer

Try the following, it may work for you too:

\documentclass[10pt]{book}
\usepackage{geometry}
\usepackage[x11names]{xcolor}
\usepackage{framed}
\colorlet{shadecolor}{LavenderBlush2}
\setlength{\OuterFrameSep}{0pt}

\usepackage{etoolbox}                           % <---
\BeforeBeginEnvironment{shaded*}{\topskip=0pt}  % <---
\AfterEndEnvironment{shaded*}{\topskip=10pt}    % <---
\usepackage{lipsum}
\usepackage{graphicx}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{shaded*}
\lipsum[1]
\end{shaded*}

\vfill
\begin{shaded*}
\lipsum[1]
\end{shaded*}
\clearpage
\begin{figure}[ht]
\includegraphics[width=\linewidth]{example-image-duck}
\end{figure}
\section{title}\lipsum
\end{document}

enter image description here