the following will produce text fragments… but if the text fragment font color is solid black, it looks like the alpha from the foreground color is used for the background color
var page = document.Pages.Add();
page.Background = Aspose.Pdf.Color.Yellow;
for (int p = 1; p < 17; p++)
{
var alpha = (p - 1) * 16;
Color systemColor = System.Drawing.Color.FromArgb(alpha, 0, 0, 255);
var asposeColor = Aspose.Pdf.Color.FromArgb(systemColor.A, systemColor.R, systemColor.G, systemColor.B);
var textFragment =
new TextFragment($"This text background is Blue at {systemColor.A}:{asposeColor.A} alpha");
Assert.That(systemColor.A, Is.EqualTo(alpha));
textFragment.TextState.BackgroundColor = asposeColor;
textFragment.TextState.ForegroundColor =
Aspose.Pdf.Color.FromArgb(254, Color.Black.R, Color.Black.G, Color.Black.B);
page.Paragraphs.Add(textFragment);
textFragment =
new TextFragment(
$"This text foreground and background is Blue at {systemColor.A}:{asposeColor.A} alpha");
textFragment.TextState.BackgroundColor = asposeColor;
textFragment.TextState.ForegroundColor = asposeColor;
page.Paragraphs.Add(textFragment);
}