Skip to content
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

Custom colors prop support #3708

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

Kolterdyx
Copy link
Contributor

@Kolterdyx Kolterdyx commented Sep 10, 2024

Implements a feature I just suggested here.

It allows to add custom colors definition for branding/theming using the ui.colors function. It can be used as follows:

from nicegui import ui

ui.colors(my_custom_color='#ff0')
ui.button('Custom color', color='my-custom-color')

ui.run()

The javascript added to make this work probably isn't optimal, but it works as intended, so that's probably what needs to be reviewed the most

@Kolterdyx Kolterdyx marked this pull request as ready for review September 10, 2024 06:56
@rodja rodja added this to the 2.2 milestone Sep 11, 2024
@rodja rodja added the enhancement New feature or request label Sep 11, 2024
@rodja
Copy link
Member

rodja commented Sep 11, 2024

Thanks @Kolterdyx. Great idea. @falkoschindler will look at it after coming back from his well deserved vacation.

Copy link
Contributor

@falkoschindler falkoschindler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request, @Kolterdyx! That's a neat addition.

I just

  • refactored the JavaScript for-loop a little,
  • made sure to replace the custom style tag to avoid growing the DOM when calling ui.colors repeatedly,
  • added custom_colors to the docstring, and
  • simplified the demo a bit.

Let's merge!

@falkoschindler falkoschindler merged commit be73337 into zauberzeug:main Sep 26, 2024
1 check passed
@Kolterdyx Kolterdyx deleted the custom-colors-prop-support branch September 26, 2024 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants