[英]How to Change the Background Color of a Slide in Google Apps Script with Google Slides
I have been trying to figure out how to change the background color of a slide in Apps Script.我一直在试图弄清楚如何在 Apps Script 中更改幻灯片的背景颜色。 I have tried
setConcreteColor(DARK1, "#FF00FF");
我试过
setConcreteColor(DARK1, "#FF00FF");
, and the error code is ReferenceError: DARK1 is not defined
. ,错误代码为
ReferenceError: DARK1 is not defined
。 Can someone please help?有人可以帮忙吗?
Recommended Solution:推荐解决方案:
You can use the setSolidFill() method.您可以使用setSolidFill()方法。 You may refer to this sample script below to change a slide page background color:
您可以参考下面的示例脚本来更改幻灯片页面背景颜色:
Script:脚本:
function myFunction() {
var hex_color = '#2a2a2a'; //The background color set in dark gray
var selection = SlidesApp.getActivePresentation().getSelection();
var currentPage = selection.getCurrentPage();
var bg = currentPage.getBackground();
bg.setSolidFill(hex_color);
}
Result:结果:
From this:由此:
To this:对此:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.