[PR #4885] FR: #4048 - Add color customization to the chatbot #24681

Closed
opened 2026-02-21 20:23:28 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/4885

State: closed
Merged: Yes


Description

FR: Close #4048 - Add color customization to the chatbot

The scope of this PR is to apply customization only to the chatbot.

  1. Add chatbot_color_theme and chatbot_color_theme_inverted to the SiteInfo
  2. Create an input on SettingsModal to set chatbot_color_theme and chatbot_color_theme_inverted
  3. Create the db migration to support those properties
  4. Create a context and a Theme builder
  5. Apply dynamic styles to components that are part of the chatbot embedded such as: Header, Welcome, Question, etc.
  6. Override and add default values in case that the theme is not built, because many components are used in contexts outside the chatbot
  7. 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.

LIMITATIONS:

  1. Colors with high luminance or those close to white may not be visually distinct due to a lack of contrast.
  2. When setting a new color in the Settings Modal, it is necessary to refresh the app to update the embedded script.
  3. The color of the "#dify-chatbot-bubble-button" is controlled by a script, so each change requires adding a new script to the website.

Fixes # (issue)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

How Has This Been Tested?

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods (Kind of)
  • optional I have made corresponding changes to the documentation
  • optional I have added tests that prove my fix is effective or that my feature works
  • optional New 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.

If you guys feel that this is not the way that you want to go, you can always let it fade into oblivion.

**Original Pull Request:** https://github.com/langgenius/dify/pull/4885 **State:** closed **Merged:** Yes --- # Description FR: Close #4048 - Add color customization to the chatbot The scope of this PR is to apply customization only to the chatbot. 1. Add `chatbot_color_theme` and `chatbot_color_theme_inverted` to the `SiteInfo` 2. Create an input on `SettingsModal` to set `chatbot_color_theme` and `chatbot_color_theme_inverted` 3. Create the db migration to support those properties 4. Create a context and a Theme builder 5. Apply dynamic styles to components that are part of the chatbot embedded such as: Header, Welcome, Question, etc. 6. Override and add default values in case that the theme is not built, because many components are used in contexts outside the chatbot 7. 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. LIMITATIONS: 1. Colors with high luminance or those close to white may not be visually distinct due to a lack of contrast. 2. When setting a new color in the Settings Modal, it is necessary to refresh the app to update the embedded script. 3. The color of the "#dify-chatbot-bubble-button" is controlled by a script, so each change requires adding a new script to the website. Fixes # (issue) ## Type of Change - [ ] 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](https://github.com/langgenius/dify-docs) - [X] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement - [ ] Dependency upgrade # How Has This Been Tested? - [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) and `cd web && npx lint-staged`(frontend) to appease the lint gods (Kind of) - [ ] `optional` I have made corresponding changes to the documentation - [ ] `optional` I have added tests that prove my fix is effective or that my feature works - [ ] `optional` New 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. If you guys feel that this is not the way that you want to go, you can always let it fade into oblivion.
yindo added the pull-request label 2026-02-21 20:23:28 -05:00
yindo closed this issue 2026-02-21 20:23:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#24681