Sheets Dark Mode as Conditional Format

31 de afișări
Accesați primul mesaj necitit

Alan Wells

necitită,
17 iul. 2020, 16:26:1617.07.2020
– Google Apps Script Community
Google Sheets for the Web Browser doesn't have a dark mode.
I don't know if mobile has it.
But you can implement your own "dark mode" either manually or with some code.

function formatAllCellsBlack_() {
try{
 
var range,rule,rules,sh,ss;  
 
  ss
= SpreadsheetApp.getActiveSpreadsheet();
  sh
= ss.getActiveSheet();
 
  range
= sh.getRange("A2:Y1000");
 
  rule
= SpreadsheetApp.newConditionalFormatRule()
   
.whenCellEmpty()
   
.setBackground("black")
   
.setRanges([range])
   
.build();
 
  rules
= [];
  rules
.push(rule);
 
  rule
= SpreadsheetApp.newConditionalFormatRule()
   
.whenCellNotEmpty()
   
.setBackground("black")
   
.setRanges([range])
   
.build();

  rules
.push(rule);
 
//Logger.log('rules: ' + JSON.stringify(rules[0]))
 
  sh
.setConditionalFormatRules(rules);
 
  range
.setFontColor('white');
}catch(e) {
 
Logger.log('Error: ' + e.message)
 
}
}



Răspundeți tuturor
Răspundeți autorului
Redirecționați
0 mesaje noi