- Jun 17, 2017
- 5,661
- 28,500
OK, so long story.
I'm currently working on a minor interface mod for a game. And I've hit a snag.
So, here's the image that the Renpy theme uses. I'm guessing it might be doing an alpha mask, or maybe it's changing the black to some other color through a transform somehow...
Essentially it's a box.png with irregular edges, that gets stretched all sorts of ways to make buttons. It's from the 'crayon' theme that ships with Renpy. So yeah, this .png has irregular transparent edges.
So Renpy currently has this set (via gui.rpy etc.) to be a darker orange, and highlight to a lighter orange. But I want to have different colors for different buttons, as in this case button is essentially a clickable background with some stuff overlayed (text, images, etc.). Kinda like a save slot, but more like an inventory that I want color coded 'background buttons' for rather than just the orange ones.
This inventory has a 'sort' function, btw (type, level, etc.), but that's not really relevant, other than to note that you may end up with a multicolored jumble depending on the sort option.
I've tried applying color tags to the button, Renpy hates that (error). I can assign a background color, but then the entire frame/box that contains the button is colored, and I lose the ragged edges/it becomes perfectly square.
I've checked the folders, and there aren't any 'orange' buttons that use this shape. Just this black one, and a gray version.
I tried setting up a style tag to assign the colors during init, but Renpy just ignored my style tag/turned the buttons/button slot backgrounds white with no color change during hover.
I can't find a good example of the Alpha mask tag, and I think you need a baseline image for that anyays (i.e. an imagebutton), but obviously Renpy has a way to change the color of this black box that I'm not seeing, as people can change the baseline interface colors via gui.rpy.
There's the IM Matrix thing, but that looks overly complicated for a simple RGB color shift. And I'm not understanding how the matrix is coded in the first place...
In short, Google has failed me, the Lemmasoft forums haven't been very helpful so far...
I COULD create a bunch of 'background' imagebuttons of different colors, but this seems unnecessary if Renpy has found an easier way to assign baseline colors already via themes and gui.rpy. My plan would be to assign various colors during init to a few variables, then call them via a variable string comparison as needed on the inventory screen (I think I have this part figured out).
I could create a bunch of 1 pixel images of various colors, then apply the mask to them, but at that point I might as well just make imagebuttons (masking an image adds to CPU/GPU overhead)...
BTW, here's some relevant 'baseline' code for my button. Note that I've commented out the highlighted background tag for now, in order to allow the 'default' button configuration to work as intended.
So, does anyone know an easy way to change that irregular black box purple, light purple, green, light green, pink, light pink, etc. etc. on the fly inside of Renpy to different colors as needed, that doesn't involve Photoshop?
Either via some 'hue' thing (preferable), or maybe via an 'alphamask' on a colored background frame?
I suck at understanding how to implement stuff from Renpy documentation/dictionary, so I need specific coding examples showing the variables as they are being used in the code, not as just some nebulous tag from a dictionary.
I'm currently working on a minor interface mod for a game. And I've hit a snag.
So, here's the image that the Renpy theme uses. I'm guessing it might be doing an alpha mask, or maybe it's changing the black to some other color through a transform somehow...
Essentially it's a box.png with irregular edges, that gets stretched all sorts of ways to make buttons. It's from the 'crayon' theme that ships with Renpy. So yeah, this .png has irregular transparent edges.
So Renpy currently has this set (via gui.rpy etc.) to be a darker orange, and highlight to a lighter orange. But I want to have different colors for different buttons, as in this case button is essentially a clickable background with some stuff overlayed (text, images, etc.). Kinda like a save slot, but more like an inventory that I want color coded 'background buttons' for rather than just the orange ones.
This inventory has a 'sort' function, btw (type, level, etc.), but that's not really relevant, other than to note that you may end up with a multicolored jumble depending on the sort option.
I've tried applying color tags to the button, Renpy hates that (error). I can assign a background color, but then the entire frame/box that contains the button is colored, and I lose the ragged edges/it becomes perfectly square.
I've checked the folders, and there aren't any 'orange' buttons that use this shape. Just this black one, and a gray version.
I tried setting up a style tag to assign the colors during init, but Renpy just ignored my style tag/turned the buttons/button slot backgrounds white with no color change during hover.
I can't find a good example of the Alpha mask tag, and I think you need a baseline image for that anyays (i.e. an imagebutton), but obviously Renpy has a way to change the color of this black box that I'm not seeing, as people can change the baseline interface colors via gui.rpy.
There's the IM Matrix thing, but that looks overly complicated for a simple RGB color shift. And I'm not understanding how the matrix is coded in the first place...
In short, Google has failed me, the Lemmasoft forums haven't been very helpful so far...
I COULD create a bunch of 'background' imagebuttons of different colors, but this seems unnecessary if Renpy has found an easier way to assign baseline colors already via themes and gui.rpy. My plan would be to assign various colors during init to a few variables, then call them via a variable string comparison as needed on the inventory screen (I think I have this part figured out).
I could create a bunch of 1 pixel images of various colors, then apply the mask to them, but at that point I might as well just make imagebuttons (masking an image adds to CPU/GPU overhead)...
BTW, here's some relevant 'baseline' code for my button. Note that I've commented out the highlighted background tag for now, in order to allow the 'default' button configuration to work as intended.
Code:
for item in itemlist:
button:
xsize 185
ysize 113
xfill False
xalign 0.0
#selected_background c_neongreen
action (SetVariable("selected_item", item),
(snip, another screen is called by the action,
various text descriptions and pics are added
at this point, similar to a load/save slot,
no issues here, stuffed being positioned
via xy/hbox/vbox. The fact there's both images
and text, and since the item image changes based
on the item in the slot, well that's why a basic
'button' is currently being used here instead of
textbutton or imagebutton.)
Either via some 'hue' thing (preferable), or maybe via an 'alphamask' on a colored background frame?
I suck at understanding how to implement stuff from Renpy documentation/dictionary, so I need specific coding examples showing the variables as they are being used in the code, not as just some nebulous tag from a dictionary.