FR: #4048 - Add color customization to the chatbot
FR: #4048 - Add color customization to the chatbot
The scope of this PR is to apply customization only to the chatbot.
- Add
chatbot_color_themeandchatbot_color_theme_invertedto theSiteInfo - Create an input on
SettingsModalto setchatbot_color_themeandchatbot_color_theme_inverted - Create the db migration to support thos properties
- Create a context and a Theme builder
- Apply dynamic styles to components that are part of the chatbot embedded such as: Header, Welcome, Question, etc.
- Override and add default values in case that the theme is not built, because many components are used in contexts outside the chatbot
- Override the style of the button.
Because Tailwind doesn't support dynamic classes because of its JIT functionality I had to include styles directly https://v2.tailwindcss.com/docs/just-in-time-mode#arbitrary-value-support. It would've been nice to keep it with classes, but I think that It can't be done that way.
Type of Change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [X] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [X] This change requires a documentation update, included: Dify Document
- [X] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
- [ ] Dependency upgrade
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [X] I have performed a self-review of my own code
- [X] I have commented my code, particularly in hard-to-understand areas
- [X] My changes generate no new warnings
- [X] I ran
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods (Kind of) - [ ]
optionalI have made corresponding changes to the documentation - [ ]
optionalI have added tests that prove my fix is effective or that my feature works - [ ]
optionalNew and existing unit tests pass locally with my changes
I considered this change useful as stated in the Issue made previously:
How will this feature improve your workflow or experience? It will improve the experience of developers and designers that want to include the embedded chatbot into a website that have clear or strict design requirements.
I encounter some errors when running bash dev/pytest/pytest_all_tests.sh but I think that were unrelated to my changes. I'm open to make some changes if needed, this is kind of a draft PR.
If you guys feel that this is not the way that you want to go, you can always let it fade into oblivion.
That's cool, I will take a look at this later.n :)
Hi, @takatost . Just to avoid confusions , when you mention 'target branch,' are you referring to the base branch when doing a PR? If that's so, I'm going to close this, because it got a little bit messy and make a new PR to main branch. Thanks