Page 1 of 1

[SOLVED] Applying styles to multiple screen texts?

Posted: Sat Jul 13, 2019 8:41 am
by Enchant00
It's probably something I mislooked, but is there a way to simplify the applying of text styles into one line than applying like the one below?

Code: Select all

vbox:
    area (400, 300, 100, 100)
    text 'Sample text 1' style 'sample text'
    text 'Sample text 2' style 'sample text'
    text 'Sample text 3' style 'sample text'
    text 'Sample text 4' style 'sample text'

style sample text:
    size 15
    bold True

Re: Applying styles to multiple screen texts?

Posted: Sat Jul 13, 2019 8:04 pm
by Alex
Haven't tested it myself, but try to set style prefix for vbox (like it made for preferences screen - https://www.renpy.org/doc/html/screen_s ... references) and create proper styles for text.
style_prefix
Provides a prefix to the style of this displayable and all of its children, ...
https://www.renpy.org/doc/html/style.ht ... nheritance
https://www.renpy.org/doc/html/screens. ... yle-prefix

Re: Applying styles to multiple screen texts?

Posted: Sun Jul 14, 2019 6:41 am
by Enchant00
Yeah, that seems to do the trick. Thanks!

For anyone else that's wondering how it's done:

Code: Select all

vbox:
    style prefix "sample" # name of the styles, in this case they all start with sample
    text 'Sample text 1' 
    text 'Sample text 2' 
    text 'Sample text 3' 
    text 'Sample text 4' 

style sample_text: # your style name used above in prefix + where you want it applied, so in this case it would be on text
    size 15
    bold True

style sample_vbox: # applies to the vbox
    area (400, 300, 100, 100)