Hatch with Shading

This is conceptually the same as Ignasi's nice answer in that the pattern is in the background color, so it determines what should be left unshaded. And in order to customize the pattern I use this answer. And of course you need to dial a shading angle to make the shading follow the north east lines.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{patterns}
% defining the new dimensions and parameters
\newlength{\hatchspread}
\newlength{\hatchthickness}
\newlength{\hatchshift}
\newcommand{\hatchcolor}{}
% declaring the keys in tikz
\tikzset{hatchspread/.code={\setlength{\hatchspread}{#1}},
         hatchthickness/.code={\setlength{\hatchthickness}{#1}},
         hatchshift/.code={\setlength{\hatchshift}{#1}},% must be >= 0
         hatchcolor/.code={\renewcommand{\hatchcolor}{#1}}}
% setting the default values
\tikzset{hatchspread=3pt,
         hatchthickness=0.4pt,
         hatchshift=0pt,% must be >= 0
         hatchcolor=black}
% declaring the pattern
\pgfdeclarepatternformonly[\hatchspread,\hatchthickness,\hatchshift,\hatchcolor]% variables
   {custom north west lines}% name
   {\pgfqpoint{\dimexpr-2\hatchthickness}{\dimexpr-2\hatchthickness}}% lower left corner
   {\pgfqpoint{\dimexpr\hatchspread+2\hatchthickness}{\dimexpr\hatchspread+2\hatchthickness}}% upper right corner
   {\pgfqpoint{\dimexpr\hatchspread}{\dimexpr\hatchspread}}% tile size
   {% shape description
    \pgfsetlinewidth{\hatchthickness}
    \pgfpathmoveto{\pgfqpoint{-1.5\hatchthickness}{\dimexpr1.5\hatchthickness+\hatchspread+\hatchshift}}
    \pgfpathlineto{\pgfqpoint{\dimexpr\hatchspread+1pt+\hatchshift}{-1pt}}
    \ifdim \hatchshift > 0pt
      \pgfpathmoveto{\pgfqpoint{0pt}{\hatchshift}}
      \pgfpathlineto{\pgfqpoint{\dimexpr1pt+\hatchshift}{-1pt}}
    \fi
    \pgfsetstrokecolor{\hatchcolor}
    \pgfusepath{stroke}
   }

\begin{document}
\begin{tikzpicture} 
\fill[left color=blue!40, right color=white,shading angle=45,line width=2pt,
postaction={pattern=custom north west lines, 
hatchthickness=1pt,hatchcolor=white}] (0,0) rectangle (3,3);
\end{tikzpicture}
\end{document}

enter image description here


Only for fun!

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\def\a{3}
\def\lw{0.2}
\draw[blue, thick] (0,0) rectangle (\a,\a);
\foreach \x [count=\i] in{0,0.1,0.2,...,\a}{
\draw [blue,line width=\lw mm,opacity=\i/45](\x,0)--(0,\x) (\a,\a-\x)--(\a-\x,\a);}
\end{tikzpicture}

\end{document}

enter image description here