({{, (RefLink[LegendFunction, paclet:ref/LegendFunction]) 
is an option for legends that specifies an overall function to apply to the generated legend.}})

OpenersNotesSection(Spacer1)Details

(RefLink[LegendFunction, paclet:ref/LegendFunction])->func specifies that func is applied on the overall legend.

(RefLink[LegendFunction, paclet:ref/LegendFunction])->(RefLink[None, paclet:ref/None]) specifies that no function should be applied.

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Use (RefLink[Framed, paclet:ref/Framed]):

SwatchLegend["Rainbow",Range[5],LegendFunction->Framed]

Customize the frame appearance:

SwatchLegend["Rainbow",Range[5],LegendFunction->(Framed[#,RoundingRadius->4,FrameStyle->LightGray]&)]

Use (RefLink[Panel, paclet:ref/Panel]):

SwatchLegend["Rainbow",Range[5],LegendFunction->Panel]

Use a function:

shadowbox[legend_]:=Graphics[{{Gray,Rectangle[{0.05,-0.05},{1.05,0.95}]},{White,EdgeForm[Gray],Rectangle[]},Inset[legend,{0.5,0.5},Center]},ImageSize->60]

SwatchLegend[{Red,Green,Blue},{"label1","label2","label3"},LegendFunction->shadowbox]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[LineLegend, paclet:ref/LineLegend])  ▪  (RefLink[PointLegend, paclet:ref/PointLegend])  ▪  (RefLink[SwatchLegend, paclet:ref/SwatchLegend])  ▪  (RefLink[BarLegend, paclet:ref/BarLegend])  ▪  (RefLink[LegendLabel, paclet:ref/LegendLabel])  ▪  (RefLink[LegendMargins, paclet:ref/LegendMargins])  ▪  (RefLink[Framed, paclet:ref/Framed])  ▪  (RefLink[Panel, paclet:ref/Panel])  ▪  (RefLink[Pane, paclet:ref/Pane])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Legends, paclet:guide/Legends])}})}})