Theming & branding
Everything users see (name, welcome copy, starters, logo, colours) is set on dyui.App, with no frontend code. Read this page to brand an app.
Everything users see is configured on dyui.App:
app = dyui.App( title="Acme Support", # header + browser tab description="Answers about orders, returns and billing.", # under the welcome heading welcome="How can we help today?", # welcome heading (default "How can I help?") placeholder="Message {title}…", # {title} is substituted logo="static/acme.svg", # local path (served by the app) or URL theme="system", # "system" | "light" | "dark" accent="emerald", # named accent or any hex starters=[ "Where is my order?", dyui.Starter("Start a return", "I'd like to return an item", icon="shop"), ],)Accent
Section titled “Accent”Named accents: indigo (default), teal, rose, amber, emerald and slate, or any hex such as "#0F766E". The app derives the soft and strong shades from it, in both themes.
theme sets the default. Users can still switch between light, dark and system in the header, and their choice is remembered in the browser. The palettes are “dawn” (warm paper) and “midnight” (deep blue-ink).
logo accepts a URL or a local file path. A local file is served from /api/logo. The logo is used in the sidebar, on the welcome screen, as the assistant’s avatar and as the favicon.
Starters
Section titled “Starters”Starters are suggestion cards on the welcome screen. A plain string is both the label and the message sent. dyui.Starter(label, message, icon=) separates them and adds an icon. Icon names include:
plane · map · search · chart · code · mail · calendar · shop · idea · write · tasks · user · food · music · news · rocket · settings · terminal · trend · zap
Most lucide icon names work too (kebab-case, e.g. life-buoy); unknown names fall back to a chat bubble.
Features
Section titled “Features”| Option | Default | Effect |
|---|---|---|
history |
True |
Show the conversation sidebar |
uploads |
True |
Allow file attachments (max_upload_mb=20) |
feedback |
True |
Thumbs up and down on replies (see @app.on_feedback) |
password |
None |
Require a shared password; see Authentication |
embed_origins |
() |
Sites allowed to show the app in an <iframe>; see Security headers |
csp |
True |
DyUI’s strict Content-Security-Policy; a string replaces it, False sends none |
@app.on_feedbackasync def feedback(fb: dyui.Feedback, chat: dyui.Chat): print(fb.message_id, fb.value, fb.comment) # value: 1, -1 or 0 (cleared)Complete example
Section titled “Complete example”A branded support app with an accent colour, welcome copy, starters with icons and a feedback handler. It needs no API key.
"""Branding from App(...): title, welcome copy, starters, accent, theme and feedback.
Save as app.py, then run: dyui run app.py"""import dyuifrom dyui import ui
app = dyui.App( title="Acme Support", description="Answers about orders, returns and billing.", welcome="How can we help today?", placeholder="Message {title}…", theme="system", # "system" | "light" | "dark" accent="emerald", # indigo, teal, rose, amber, emerald, slate or any hex like "#0F766E" starters=[ "Where is my order?", dyui.Starter("Start a return", "I'd like to return an item", icon="shop"), ], uploads=False,)
@app.on_messageasync def reply(msg: dyui.Message, chat: dyui.Chat): yield "Thanks! Rate this answer with the thumbs below it." yield ui.Callout("Returns are free within 30 days.", level="info", title="Returns")
@app.on_feedbackasync def feedback(fb: dyui.Feedback, chat: dyui.Chat): print("feedback:", fb.message_id, fb.value, fb.comment) # value: 1, -1 or 0 (cleared)-
Save it as
app.pyin a new, empty file, or download app.py. -
Run it:
Terminal window pip install dyuidyui run app.py -
Open http://localhost:8000, send a message and use the thumbs under the reply: the feedback is printed in your terminal.
See also
Section titled “See also”- Authentication: put a password in front of the app.
- Production server: embedding the app in another site.