Neural Sketch

Fill Between

Visually connect and emphasize areas between elements

Introduction

Move beyond arrows — instead of just pointing at things, fill the space between them. With \nskFillBetween, you can create fluid, ambient shapes that connect elements without overwhelming them. These filled areas become a kind of visual glue: they group, guide, and suggest.

This visual overlay can help group related parts, emphasize sequential flows, or annotate areas without introducing new geometry.


Usage

\nskFillBetween[
  from=<source>, to=<target>,
  fill=<color>, border-color=<border-color>,
  opacity=<opacity>,
  edge=<straight|curved>,
  orientation=<vertical|horizontal>,
  corner-offset=<dimension>
]

Parameter Overview

ParameterDescriptionDefault
fromID of the first block or coordinaterequired
toID of the second block or coordinaterequired
fillFill color between elementstransparent
border-colorBorder color of the filled areanone
opacityOpacity of the filled area (01)1
edgeDetermines if edges are straight or curvedstraight
orientationDirection of filling: vertical or horizontalvertical
corner-offsetOffset to adjust the corner alignment (straight edge)0mm
inInbound angle{}
outOutbound angle{}

Examples

Straight vs. Curved Edges

Here’s an illustrative example showcasing both straight and curved fills:

% Straight Edges
\nskContainer[text-north=Straight, text-north-loc=west,]{
  \nskBlock[id=ablock, text-center=\Large A, width=2cm, height=1cm, border-radius=0mm,]
  \nskBlock[id=bblock, text-center=B, last-pos={below=.8cm}, border-radius=0mm,]
  \nskFillBetween[
    from=ablock, to=bblock,
    edge=straight,orientation=vertical,corner-offset=0mm,
  ]
  \nskBlock[id=ablock, text-center=\Large A, width=1cm, height=2cm, border-radius=0mm, last-pos={above right=-.5cm and 1.5cm},]
  \nskBlock[id=bblock, text-center=B, last-pos={right=.8cm}, border-radius=0mm,]
  \nskFillBetween[
    from=ablock, to=bblock,
    edge=straight,orientation=horizontal,corner-offset=0mm,
  ]
}

Advanced Example

This advanced use case demonstrates multiple fills, annotations, and coordinate-based fills:

examples/r-fields.tex
% block 0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <<<
\nskBlock[id=ba, width=8cm, height=1cm, border-radius=1mm,]
\nskMarkPath[
  path-width=8cm,skip-first=true, skip-last=true,step=10mm
]{(ba.south west) -- (ba.south east)}{
  \draw[black] (0,0) -- (0,1cm);
}
 
\foreach \i in {0,...,8}
  {
    \nskCoord[id=rat\i, pos={left=0mm of ba.north west}, shift-x=(10mm*\i), shift-y=4mm, marker=none,]
    \nskCoord[id=ra\i, pos={left=0mm of ba.south west}, shift-x=(10mm*\i), shift-y=0mm, marker=none,]
  }
 
\nskBlock[
  id=rb00,fill=none,shadow=false,border-color=none, border-radius=0mm,
  width=3cm, height=1cm,pos={above right=-1.3mm and 0mm of ra0},
  anchor=south west,
]
\nskBlock[
  id=rb01,fill=none,shadow=false,border-color=none, border-radius=0mm,
  width=3cm, height=1cm,pos={above right=-1.3mm and 0mm of ra5},
  anchor=south west,
]
 
% block 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <<<
\nskBlock[id=bb, width=2cm, height=1cm, pos={below=3cm of ba}, border-radius=1mm,]
\nskMarkPath[
  path-width=2cm,skip-first=true, skip-last=true,step=10mm
]{(bb.south west) -- (bb.south east)}{
  \draw[black] (0,0) -- (0,1cm);
}
 
\nskBlock[
  id=rb10,fill=none,shadow=false,border-color=none,
  width=1cm, height=1cm,pos={above right=0cm of bb.south west},
  anchor=south west,
]
\nskBlock[
  id=rb11,fill=none, shadow=false,border-color=none,
  width=1cm, height=1cm,pos={above right=0cm and 1cm of bb.south west},
  anchor=south west,
]
 
% measures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <<<
\nskConnect[id=t0, from=rat0, to=rat3, arrow-tip={|-}, arrow-style={very thick}, shorten-to=.5mm,]
\nskConnect[
  id=t1,from=rat3,to=rat5,color=nskStrongCyan,
  arrow-tip={|-|},arrow-style={very thick},shorten-to=.5mm,
]
\nskConnect[id=t2,from=rat5, to=rat8, arrow-tip={-|},arrow-style={very thick},]
 
% ttext ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <<<
\nskMarkPath[at=.5,]{t0}{\node[above] {$s_l\cdot r_l$};}
\nskMarkPath[at=.5,]{t1}{\node[above] {$r_l=2$};}
\nskMarkPath[at=.5,]{t2}{\node[above] {$s_{l-1}$};}
 
% fills ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <<<
\nskFillBetween[from=ba, to=bb, edge=curved, orientation=vertical]
\nskFillBetween[from=rb00, to=rb10, edge=curved, orientation=vertical]
\nskFillBetween[from=rb01, to=rb11, edge=curved, orientation=vertical]
 
% annotate ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <<<
\nskAnnotate[
  pos={right=2cm of ba},
  anchor-from=west,
  connect-to=ba.east,
  header={\nskBlockIDLast[1]},
  fill=none,
  header={Explanation},
  border-type=none,
  title={Key Observations},
  text={
      This is an important portion.
    },
  text-align=justify,
  connect-opts = {
      arrow-style={dotted, thick},
    },
  tikz-opts={},
]
 
\nskAnnotate[
  pos={right=5cm of rb11},
  anchor-from=west,
  connect-to=rb11.east,
  header={\nskBlockIDLast[1]},
  fill=none,
  header={Explanation},
  border-type=none,
  title={Key Observations},
  text={
      This is an important portion.
    },
  text-align=justify,
  connect-opts = {
      arrow-style={dotted, thick},
    },
  tikz-opts={},
]

Best Practices

  • Less is more: avoid flooding the diagram.
  • Use low-opacity or brand-tinted fills to avoid visual conflict.
  • Combine fills with annotations for clarity — use them to imply, not just decorate.

Key Takeaway

The \nskFillBetween command provides an effective method to visually emphasize regions and relationships between diagram elements, enhancing both clarity and aesthetics with customizable fills, edges, and orientation controls.


Reference Table

PropTypeDefault
corner-offset?dimension{}
draw?token listnskStrongBlue!50
edge?choicestraight
fill?token listnskStrongBlue!20
from?token list{}
opacity?number0.4
orientation?choicevertical
to?token list{}
in?token list{}
out?token list{}

On this page