如何在 phppresentation 幻灯片中使用自定义颜色作为背景

How to use custom colors for background in phppresentation slide

我希望能够使用自定义颜色,但似乎无法绕过 styleColor 常量。我怎样才能输入我自己的颜色,比如#008080

// Create slide
echo date('H:i:s') . ' Create slide'.EOL;
$oSlide1 = $objPHPPresentation->getActiveSlide();
$oSlide1->addShape(clone $oShapeDrawing);
$oSlide1->addShape(clone $oShapeRichText);
// Slide > Background > Color
$oBkgColor = new Color();
$oBkgColor->setColor(new StyleColor(StyleColor::COLOR_DARKGREEN));
$oSlide1->setBackground($oBkgColor);

你可以这样做:

// Create slide
echo date('H:i:s') . ' Create slide'.EOL;
$oSlide1 = $objPHPPresentation->getActiveSlide();
$oSlide1->addShape(clone $oShapeDrawing);
$oSlide1->addShape(clone $oShapeRichText);
// Slide > Background > Color
$oColor = new StyleColor();
$oColor->setRGB('008080');
$oBkgColor = new Color();
$oBkgColor->setColor($oColor);
$oSlide1->setBackground($oBkgColor);