Change background color of cells with a function

Hi everyone,

I’m new and I’m trying to change the background color of cells with some function in JS, maybe passing the cell or range of cells as input and a color. It is possible to do that? or only with toolbar button?

thanks in advance

UPDATE: I solved with the setStyle() function!

You’re right. the setSyle() method solves this issue:
https://docs.dhtmlx.com/spreadsheet/api__spreadsheet_setstyle.html