-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python backend to theming #2931
Conversation
Theming ready for review! New API:
Also created the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aliabid94 This is awesome 👏
I like how you can set high-level theme attributes but then override the values for specific fields.
Creating themes via python is hard (I had to look at the svelte files to know what I was modifying) but that's not really related to the api and the theme builder can take care of making it easier.
Left a couple of nits. Thanks!
gradio/themes/utils/size.py
Outdated
@@ -0,0 +1,110 @@ | |||
class Size: | |||
def __init__(self, xxs, xs, sm, md, lg, xl, xxl): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would add type hints here and for Color.
@@ -89,7 +89,7 @@ No changes to highlight. | |||
No changes to highlight. | |||
|
|||
## Full Changelog: | |||
No changes to highlight. | |||
* Added backend support for themes by [@aliabid94](https://github.com/aliabid94) in [PR 2931](https://github.com/gradio-app/gradio/pull/2931) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in the wrong place.
Looks really good @aliabid94! My one feedback (copied from Slack) is:
Let's merge this in after we've released 3.20! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new styles look good to me @aliabid94 ! Only thing I noticed missing is the comment about queue=False
and not deleting style
prop from the component. Not sure what you and @dawoodkhan82 agreed to.
If color_map
is deprecated, is there a way to target the chatbot bubble colors with the python theming api? I don't think so but want to make sure.
Sorry, what comment?
Restored the style prop to chatbot (without color_map)
The colors for the chatbot inherit from theme values as such: .bot,
.pending {
border-color: var(--color-border-primary);
background-color: var(--color-background-secondary);
}
.user {
border-color: var(--color-border-accent);
background-color: var(--color-accent-soft);
} Users can modify these theme variables, or for more control, hijack with the CSS kwarg. |
@aliabid94 Thanks for responding + clarifying the new css variables for the chatbot! That comment was meant to go to this PR #3370 lol sorry about that 🙈 This PR looks good to me though! |
Thanks everyone! Finally merging |
Created python backend that will allow users to create and modify backends from python. User's can specify existing themes as:
and they can modify themes, with full type hints, via:
Here's how it works:
Currently the best way I could think of implementing, lmk what you guys think.
Example running demo/blocks_xray below:
![Recording 2023-01-04 at 18 29 06](https://user-images.githubusercontent.com/7870876/210675264-347cf828-8754-4c14-a537-5c600cf79ead.gif)
(for some reason, vscode isn't type hinting the theme attributes for me, will figure out. For now looking for feedback on general implementation_
Closes: #2354