Ren'Py How to add "im.matrix.saturation" to the original buttons in Ren'py

Avalonica

Newbie
Oct 11, 2017
40
20
Hello all, I would just love to implement this "im.matrix.saturation" over to the original Ren'py buttons without making lots of new code for a button every time I need it.

Here is the code I want to use on the original Ren'py buttons in gui.rpy and screens.rpy:
Code:
define over = im.matrix.saturation(0.98) * im.matrix.contrast(1.07) * im.matrix.brightness(0.07)
define noop = im.matrix.saturation(1.02) * im.matrix.contrast(0.93) * im.matrix.brightness(-.07)
define live = im.matrix.saturation(2.38) * im.matrix.contrast(0.93) * im.matrix.brightness(0.07)

This is how I currently use it for stand-alone buttons:
Code:
image menu_btn = 'gui/button/button_generic_popup_full.png'
image menu_btn_idle = Frame('menu_btn',
                            left=14, top=9, right=10, bottom=17)
image menu_btn_over = Frame(im.MatrixColor(ImageReference('menu_btn'), over),
                            left=14, top=9, right=10, bottom=17)
image menu_btn_noop = Frame(im.MatrixColor(ImageReference('menu_btn'), noop),
                            left=14, top=9, right=10, bottom=17)
image menu_btn_live = Frame(im.MatrixColor(ImageReference('menu_btn'), live),
                            left=14, top=9, right=10, bottom=17)

style menu_button:
    align (.5, .5)
    hover_background 'menu_btn_over'
    idle_background 'menu_btn_idle'
    insensitive_background 'menu_btn_noop'
    padding (23, 10, 20, 15)
    selected_background 'menu_btn_live'
    selected_hover_background 'menu_btn_over'
    xysize (200, 55)
So, it's a dream of mine to get rid of this code and have the "im.matrix.saturation" work on the Ren'py "vanilla" buttons directly, but I can't find any reference to the physical .png files in gui.rpy or screens.rpy in order to add the "im.matrix.saturation" effect.

Can anyone of you veterans please (if possible) post a workaround or something "that works" since this is the final step I have to solve before I can start to work on my actual Visual Novel. :giggle:
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,957
16,188
So, it's a dream of mine to get rid of this code and have the "im.matrix.saturation" work on the Ren'py "vanilla" buttons directly [...]
I can't test right now, but renaming your style from menu_button to navigation_textbutton should works if I understood correctly what you want to do.


, but I can't find any reference to the physical .png files in gui.rpy or screens.rpy in order to add the "im.matrix.saturation" effect.
Which is normal since the vanilla menu don't use images for the buttons.