background-colorphppresentation

How to use custom colors for background in phppresentation slide


I want to be able to use custom colors but can't seem to get around the styleColor constants. How can I enter my own colors like #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);

Solution

  • you can do like this :

    // 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);