TLegend* legend = new TLegend(x1, y1, x2, y2); legend->SetFillStyle(1001); // Solid black fill style
TLegend* legend = new TLegend(x1, y1, x2, y2); legend->SetFillStyle(0); // Transparent fill styleIn both examples, we create a new TLegend object and set its fill style using the SetFillStyle function. The first example sets the fill style to 1001 which represents a solid black color, while the second example sets the fill style to 0 which represents a transparent background. The package library used in the examples is ROOT.