Closed lhecht closed 2 years ago
I found the answer to my problem. Maybe it is useful for someone else as well.
Python changed how **.osenviron works. From "PEP 584 -- Add Union Operators To dict" in python 3.9 it becomes possible to use the syntax with the |-operator. Before two dictionaries are merged with "," a comma.
So the solution was: background-color: {{ {QTMATERIAL_PRIMARYCOLOR}, opacity(0.4)}};
I am using a custom stylesheet to add more colors and adapt some other properties.
I would like to be able to set the opacity of the default theme colors, but can't find a solution. I think I tried all possible combinations of curly brackets around the background color entry and I can't get it to work. Do you know how to make it work?
custom.css looks like the following:
QPushButton {{ color: {QTMATERIAL_PRIMARYTEXTCOLOR}; background-color: {{{QTMATERIAL_PRIMARYCOLOR}|opacity(0.4)}}; }}
And I used it in PyQt5: apply_stylesheet(app, theme='./resources/my_theme.xml') stylesheet = app.styleSheet()
with open('./resources/custom.css') as file: app.setStyleSheet(stylesheet + file.read().format(**os.environ))
I am using python 3.8.10
Thank you so much for the great package.