# How to define a section(subsection) with custom background colorpage?

Is it possible to redefine certain \section or \subsection to have custom pagecolor?

There are certain solutions like:

underline and background color for section or subsection

Change background color for only a section of the page?

and so on.

However, this does not quite solve what I want. Some of these solutions need predefined color boxes at fixed positions etc.

What would be nice to have is, whenever this section (say \newsection) starts, the page color from that point onwards including the section title becomes different until the section ends (which means a new normal \section starts. Basically within the environment of the \newsection ). For that, the whole page does not need to be a different color and the texts in this \newsection might continue over the next page and so does the background color. The complete page in the range of \newsection can have a different background including possibly the page numbers, left-right margins, etc. or, it will also be sufficient to have the text and equations area in \newsection.

The second example link above is much similar but that is only on the name of the section not on the content of the section.

You can do this with snugshade of frame package. You need to define the desired color just before the use of snugshade. This way yo can change color for all one section or one fraction of this one. You can apply this method to a chapter. Here is un example of code:

\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{graphicx,color,framed,lipsum}
\begin{document}
\chapter{Test chapter}
\begin{oframed}
\lipsum
\end{oframed}
\section{Uno}
\lipsum[1-3]
\section{Due}
\lipsum[5-7]