TPaveText* text = new TPaveText(0.2,0.2,0.8,0.8); text->SetFillColor(kYellow); text->AddText("Hello world"); text->Draw();
TPaveText* text = new TPaveText(0.2,0.2,0.8,0.8); text->SetFillColor( TColor::GetColor("#ff0000") ); // set color using hex code text->AddText("Error message"); text->Draw();This code creates a text box, sets the background color to red using SetFillColor() and passing in a hex code using TColor::GetColor(), adds the text "Error message", and then draws the box on the canvas. Both examples use the ROOT package library.