Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
AppScript Slides Get Hex Code of Text Box

For Apps Script, I'm trying to print the Hex code of the fill of text box. Any ideas. I'm stuck once I get to .getSolidFill(). This line does not work for me: shape.getFill().getSolidFill().getColor().asRgbColor().asHexString())

function adjustFillColor() {


  // // Open the presentation and get the slides in it.
  let deck = SlidesApp.openById(masterDeckID);
  let slides = deck.getSlides();

  let masterSlide = slides[1];

  let slide = masterSlide.duplicate();

  slide.getShapes().forEach(shape => { // Iterate through every shape in the slide
          if (shape.getFill().getSolidFill()!== null){
              shape.getFill().setSolidFill("#000000");
          }
      
    });               
   
  };


about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

In your script, how about the following modification?

From:

console.log("Color String: " +shape.getFill().getSolidFill());

To:

console.log("Color String: " + shape.getFill().getSolidFill().getColor().asRgbColor().asHexString());
  • When this modified script is run, you can retrieve the color of shapes as the HEX value.

  • Or, how about the following modification?

    • From

        slide.getShapes().forEach(shape => {
           if (shape.getFill().getSolidFill()!== null)
              console.log("Color String: " +shape.getFill().getSolidFill());
      
    • To

        masterSlide.getShapes().forEach(shape => {
          var solidFill = shape.getFill().getSolidFill();
          var color = solidFill && solidFill.getColor();
          var rgbColor = color && color.getColorType() == SlidesApp.ColorType.RGB ? color.asRgbColor() : null;
          if (solidFill && color && rgbColor) {
            console.log("Color String: " + rgbColor.asHexString());
          }
        });
      

References:

  • getSolidFill()
  • getColor()
  • asRgbColor()
  • asHexString()
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda