[Solved] Window/"widget" Opacity

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

[Solved] Window/"widget" Opacity

#1 Post by mjshi » Mon May 11, 2015 8:37 pm

I'll get straight to the point: Is it possible to make these:
Screenshot_2.png
Screenshot_1.png
Screenshot_1.png (126.29 KiB) Viewed 1014 times
Screenshot_3.png
slightly less transparent? (I'm thinking, like, 80% opacity or something). If so, how?

EDIT: And no, I don't want to use an image/frame xD
Last edited by mjshi on Mon May 11, 2015 9:57 pm, edited 1 time in total.

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: Window/"widget" Opacity

#2 Post by SinnyROM » Mon May 11, 2015 9:41 pm

You can set it as a solid colour with alpha values: http://www.renpy.org/doc/html/style_pro ... rty-values

Code: Select all

screen preferences():
    window:  # or frame, button, etc.
        background "#00000080"  # hexcode, black with 50% opacity
        # or 
        background (255, 255, 255, 205)  # RGBA tuple, white with about 80% opacity  
If you want to set it so more than one element has the same opacity and appearance, you can create a style.

Code: Select all

screen preferences():
    frame:
        style "blue_glass_frame"
    #or
    frame:
        style_group "red_glass"
        textbutton "Red too" action NullAction()

init:
    style blue_glass_frame:
        background (200, 200, 255, 150)
    style red_glass_frame:
        background (255, 200, 200, 175)
    style red_glass_button:
        background (255, 200, 200, 175)
You can also use a transform which has an alpha property for animations and more complex appearances if solid colour isn't enough: http://www.renpy.org/doc/html/atl.html# ... properties

User avatar
mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: Window/"widget" Opacity

#3 Post by mjshi » Mon May 11, 2015 9:56 pm

Thank you very much! I never really understood style properties...

Found some other non-screen language solutions:
Hex color codes apparently have opacity values: "ffffff80" for an 80% opacity white, "9CCAFF40" for a 40% opacity blue, etc.
For anyone else who has this same problem and is using a preinstalled theme, the folder with the theme slider images (which, apparently, are all transparent) can be found here: C:\....Ren'py\renpy\common\_theme_[name of theme]
Marking as solved, again, thank you!

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: [Solved] Window/"widget" Opacity

#4 Post by SinnyROM » Mon May 11, 2015 10:22 pm

No problem! Also want to say thank you for your bar tutorial. It's funny that just now I've been having issues with styling bar elements and you happened to have the tutorial I needed in your signature.

Post Reply

Who is online

Users browsing this forum: No registered users