# Highlighting intersections

I would like to highlight the region C in the Euler diagram below. I tried to play around with fill opacity command, but I was not able to highlight C alone. Should I use the intersections libraries to figure out the coordinates of intersection of C and B and proceed? Can someone help me with this?

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}
\draw[fill=green, draw = black,fill opacity=0.5] (-1.5,0) circle (3);
\draw[fill=blue!30!white, draw = black,fill opacity=0.5] (1.5,0) circle (3);
\node at (-2,1) (B) {\large\textbf{B}};
\node at (2,1) (C) {\large\textbf{C}};
\node at (0,0) (D) {\large\textbf{D}};
\end{tikzpicture}
\end{document}


I used Paul Gaborit's invclip style from his answer to How can I invert a 'clip' selection within TikZ?:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections,positioning}

\tikzset{invclip/.style={clip,insert path={
(-16383.99999pt,-16383.99999pt) rectangle (16383.99999pt,16383.99999pt)
}}}

\begin{document}

\begin{tikzpicture}
% The intersection region D
\begin{scope}
\clip (1.5,0) circle (3cm);
\clip (-1.5,0) circle (3cm);
\fill[blue,fill opacity=0.2] (-1.5,0) circle [radius=3cm];
\end{scope}
% The B+D region
\begin{scope}
\clip (-1.5,0) circle (3cm);
\fill[green,fill opacity=0.2] (-1.5,0) circle [radius=3cm];
\end{scope}
\node at (-2,1) (B) {\large\textbf{B}};
\node at (0,0) (D) {\large\textbf{D}};
% Region C
\begin{pgfinterruptboundingbox} % useful to avoid the rectangle in the bounding box
\path[invclip]
(-1.5,0) circle (3cm);
\end{pgfinterruptboundingbox}
\fill[blue,fill opacity=0.9] (1.5,0) circle [radius=3cm];
\node at (2,1) (C) {\large\textbf{C}};
\end{tikzpicture}

\end{document}


You can do it by using two clip commands:

## Code

\documentclass[tikz,border=2mm]{standalone}
% declare a new layer
\pgfdeclarelayer{background}
% give the order of layers from back to front
\pgfsetlayers{background,main}

\begin{document}
\begin{tikzpicture}
\draw[fill=green, draw = black,fill opacity=0.2] (-1.5,0) circle (3);
\draw[fill=blue!50, draw = black,fill opacity=0.2] (1.5,0) circle (3);
\node at (-2,1) (B) {\large\textbf{B}};
\node at (2,1) (C) {\large\textbf{C}};
\node at (0,0) (D) {\large\textbf{D}};
% begin a background layer to avoid painting over stuff
\begin{pgfonlayer}{background}
% scope to keep clipping local
\begin{scope}
% clip a large enough rectangle, then cut out the left circle
\clip (-4.5,-3) rectangle (4.5,3) (-1.5,0) circle (3);
% clips do stack; so clip only the left circle from the remaining region --> region C remains
\clip (1.5,0) circle (3);
% fill right circle, due to clipping only region C
\fill[blue!50,opacity=1] (-5,-4) rectangle (5,4);
\end{scope}
\end{pgfonlayer}
\end{tikzpicture}
\end{document}