How to use custom colors for background in phppresentation slide - background-color

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

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

Related

How can I add data to an existing PowerPoint presentation using Node?

I have a PowerPoint template with placeholder data. I need to swap out the placeholder text with some numbers using Node, but I'm having trouble finding a package that supports this. Has anyone seen anything along these lines?
Have you looked into the PowerPoint JavaScript API?
For example:
Call the ShapeCollection.getItem(key) method to get your Shape object
Update the text value via Shape.textFrame.textRange.text
Related example from Microsoft's docs:
// This sample creates a light blue rectangle with braces ("{}") on the left and right ends
// and adds the purple text "Shape text" to the center.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.slides.getItemAt(0).shapes;
const braces = shapes.addGeometricShape(PowerPoint.GeometricShapeType.bracePair);
braces.left = 100;
braces.top = 400;
braces.height = 50;
braces.width = 150;
braces.name = "Braces";
braces.fill.setSolidColor("lightblue");
braces.textFrame.textRange.text = "Shape text";
braces.textFrame.textRange.font.color = "purple";
braces.textFrame.verticalAlignment = PowerPoint.TextVerticalAlignment.middleCentered;
await context.sync();
});

extendscript after effects colorize not working or how do i add it

am trying to add the effect Colorize Blue wash or Colorize -blue wash to my seleced layer it does not work.
when manually selected it adds color balance and color balance hld with modified setting .
now how do i use my code
var myComp = app.project.activeItem;
var preCompLayer = myComp.selectedLayers[0];
preCompLayer.property("Effects").addProperty("Colorize - blue wash");
image below snapshot
You are attempting to apply a preset as though are you applying an effect. First you'll need to find the path to the preset file in your After Effects installation. You can apply the preset like so:
var myComp = app.project.activeItem;
var preCompLayer = myComp.selectedLayers[0];
// Path to your preset file below
var presetFile = File("/your-After-Effects-path/Presets/Image - Creative/Colorize - blue wash.ffx");
preCompLayer.applyPreset(presetFile);

Delete text in textbox without deleting the textbox on canvas in fabric.js

I'm using fabric.js and have IText textboxes on canvas. The user can freely move the textbox around and also edit the text within. How to avoid a textbox being deleted (removed from the canvas) when the user deletes the text using delete key and there's no more text?
Thanks for the response.
deleteText(activeObject) {
var startIndex = activeObject.selectionStart;
var endIndex = activeObject.selectionEnd;
if (endIndex > 0 && startIndex != endIndex) {
var text = activeObject.text;
var newText =
text.substring(0, startIndex) +
text.substring(endIndex + 1, text.length);
activeObject.set("text", newText);
this.canvas.fire("object:modified");
} else {
this.canvas.remove(activeObject);
}
}
have 2 versions of answer
1.Your are deleting textbox using this line of code , try commenting it and see what happens
this.canvas.remove(activeObject);
2.Textbox is not being deleted , you can't see it because of white canvas background and emptiness inside textbox, since there is no text , try mousedowning a canvas and select a big area , check if you are able to select your textbox this way

define Frontend Layouts for page trees

I'm using the field Frontend-Layout at my TYPO3 7.6-Backend. Because my website will have four different departments with different colours in frontend.
So I'm using:
TCEFORM {
pages {
layout {
altLabels {
0 = [ blue]
1 = [ orange ]
2 = [ green]
3 = [ yellow]
}
}
}
} ### TCEFORM
At my FLUIDTEMPLATE I'll wrap an <div>-wrapper, to set my different languages globally at my stylesheet. f.e. div.wrap.blue { background-color:blue;}
<div class="wrap
{f:if(condition:'{data.layout} == 0',then:'blue')}
{f:if(condition:'{data.layout} == 1',then:'orange')}
{f:if(condition:'{data.layout} == 2',then:'green')}
{f:if(condition:'{data.layout} == 3',then:'yellow')}">
...
This works perfect for me.
But how can I slide (or inherit) the frontend-layout-info from my parent-page to the subpages on my pagetree? I don't want to choose the frontend layout in page properties everytime, if I will add a new page into my pagetree. This must be working automatically. Is this possible? With slide?
For example
*ROOT
+ parent blue
~~ sub blue 1 /* these pages also have frontend layout 0 */
~~ sub blue 2
+ parent orange
~~ sub orange 1
+ parent green
...
+ parent yellow
...
Thebks for your opinion or tips ..
I don't think it's dead simple to set the {data.layout} layout recursively without manipulating the database. I have three 'solutions' coming to mind to solve your problem:
1) Create four Backend Layouts that you can select for your current and childpages. (Basically rinse and repeat what you have done for your first backend layout)
2) Using your layout modes you could try setting a body class using typoscript like so (i did not test this):
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.field = data.layout
page.bodyTagCObject.wrap = <body class="color-|">
3) Use a similar typoscript but update the value using typoscript conditions such as [pidInRootline]
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.wrap = <body class="blue">
[PIDinRootline = 1]
page.bodyTagCObject.wrap = <body class="orange">
[global]
[PIDinRootline = 2]
page.bodyTagCObject.wrap = <body class="green">
[global]
# and so on
I had your same problem and this typoscript worked fine for me,
the result is what you wanted to reach.
as you can see the 20.10 object is used when frontend layout is set on the page, while the 20.20 object is used when frontend layout is not set and takes it in slide mode:
page {
bodyTagCObject >
bodyTagCObject = COA
bodyTagCObject {
stdWrap.noTrimWrap = |<body |>|
20 = COA
20 {
wrap = class="|"
10 = TEXT
10 {
if.isTrue.data = page:layout
data = page:layout
noTrimWrap = |page-layout-| |
}
20 = TEXT
20 {
if.isFalse.data = page:layout
data = levelfield:-2, layout, slide
noTrimWrap = |page-layout-|
}
}
}
}
I hope I have been helpfull.

How do you add a title to a legend in Flot

I want to add a title to the legend box in Flot? For example, if my legend shows different Products, I want the title above the legend box to say "Products".
Somewhat hacky, but you can do it like this:
var $legend = $('#chart > div.legend'); // replace #chart with the id from your div
var $legendTitle = $legend.find('div').first();
$legendTitle.html('Products').height($legendTitle.height() + 15);
$legend.find('table').first().css('top', $legendTitle.position().top + 15);

Resources