Last active
November 17, 2023 22:28
-
-
Save GoodBoyNinja/83b8c95969a5341083cca392f4321c77 to your computer and use it in GitHub Desktop.
Use this to paint a group or a panel object by passing the object variable and an RGBA color ([x,x,x,x])
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FillPanel(panelOBJ, color) { | |
if ( | |
panelOBJ && | |
color && | |
(panelOBJ.type == "panel" || | |
panelOBJ.type == "group" || | |
panelOBJ.type == "dialog" || | |
panelOBJ.type == "palette" || | |
panelOBJ.type == "window") && | |
panelOBJ.graphics.BrushType | |
) { | |
try { | |
color[3] = color[3] == undefined ? 1 : color[3]; | |
if (!(color.length >= 3)) { | |
// color is not propper rgb array | |
return; | |
} | |
var g = panelOBJ.graphics; | |
if (g !== undefined) { | |
g.backgroundColor = g.newBrush(g.BrushType.SOLID_COLOR, color); | |
} | |
} catch (e) { | |
// something went wrong, you could print or alet an error here | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment