This skill should be used when implementing "professional styling", "theme systems", "brand consistency", "design tokens", "visual identity", "color schemes", "typography systems", or when creating cohesive visual themes for applications.
This skill provides comprehensive theming capabilities for creating professional, brand-consistent visual identities across applications. It includes theme generators, design token management, and automated styling systems specifically optimized for Streamlit applications.
Use this skill when implementing:
from theme_factory import ThemeFactory, ThemeMode
# Create factory and generate theme
factory = ThemeFactory()
theme = factory.create_real_estate_theme(
primary_color="#1e40af",
mode=ThemeMode.LIGHT
)
# Apply to Streamlit
from theme_factory import apply_theme_to_streamlit_app
apply_theme_to_streamlit_app("Real Estate Professional (Light)")
# Create luxury theme with dark mode
luxury_theme = factory.create_luxury_real_estate_theme(
mode=ThemeMode.DARK
)
# Register custom theme
factory.register_theme(luxury_theme)
# Save theme for reuse
factory.save_theme(luxury_theme, Path("themes/luxury_dark.json"))
import streamlit as st
from theme_factory import create_theme_selector
# Add theme selector to sidebar
selected_theme = create_theme_selector()
# Theme is automatically applied to app
st.title("My Application")
st.markdown("This content uses the selected theme")
Complete theme specification with design tokens for colors, typography, spacing, shadows, and animations.
See: reference/theme-architecture.md for complete data structures
Factory class for generating and managing themes.
Key Methods:
create_real_estate_theme() - Professional business themecreate_luxury_real_estate_theme() - Premium theme with gold accentsregister_theme() - Add theme to factorysave_theme() / load_theme() - PersistenceApplies themes to Streamlit applications via CSS injection.
See: reference/streamlit-integration.md for implementation details
Color manipulation and palette generation utilities.
Key Methods:
generate_palette() - Create 10-shade palette from base colorlighten_color() / darken_color() - Color adjustmentsensure_contrast() - Accessibility compliance# 1. Define brand colors
brand_primary = "#2563eb" # Your brand blue
brand_secondary = "#64748b" # Neutral gray
brand_accent = "#f59e0b" # Warning/CTA orange
# 2. Create base theme
theme = factory.create_real_estate_theme(
primary_color=brand_primary,
mode=ThemeMode.LIGHT
)
# 3. Customize if needed (advanced)
# See: reference/advanced-customization.md
# 4. Apply to app
injector = StreamlitThemeInjector(theme)
injector.inject_theme()
import streamlit as st
# Theme selector in sidebar
if 'theme_mode' not in st.session_state:
st.session_state.theme_mode = 'light'
mode = st.sidebar.radio("Theme Mode", ['light', 'dark'])
# Apply appropriate theme
theme_name = f"Real Estate Professional ({mode.title()})"
theme = apply_theme_to_streamlit_app(theme_name)
# Access current theme from session state
theme = st.session_state.get('current_theme')
if theme:
# Use design tokens for consistent styling
st.markdown(f"""
<div class="theme-card">
<h3 class="theme-title">Lead Score: 85/100</h3>
<p class="theme-text">High-priority lead detected</p>
</div>
""", unsafe_allow_html=True)
All themes include comprehensive design token systems:
See: reference/design-tokens.md for complete specifications
Cause: Theme injector called after components render
Solution: Call apply_theme_to_streamlit_app() early in app initialization
Cause: Mode mismatch (dark colors on light background)
Solution: Ensure ThemeMode matches intended display context
Cause: CSS specificity issues
Solution: Use inject_component_styles() for targeted overrides
For advanced theming scenarios, see:
reference/theme-architecture.md - Complete data structuresreference/streamlit-integration.md - Advanced CSS injection patternsreference/advanced-customization.md - Creating fully custom themesreference/color-theory.md - Color palette generation algorithmsexamples/custom-theme-builder.py - Complete custom theme exampleTheme Factory is integrated with EnterpriseHub components:
# In streamlit_demo/app.py
from theme_factory import create_theme_selector
# Add theme selector
create_theme_selector()
# All components automatically use theme
# - Lead dashboards
# - Property cards
# - Analytics charts
# - Executive metrics
See: examples/enterprise-hub-integration.py for complete integration patterns
| Task | Command |
|---|---|
| Create theme | factory.create_real_estate_theme() |
| Apply theme | apply_theme_to_streamlit_app(name) |
| Add selector | create_theme_selector() |
| Generate palette | ColorUtilities.generate_palette(base) |
| Save theme | factory.save_theme(theme, path) |
| Load theme | factory.load_theme(path) |
Version: 2.0.0 (Token-Optimized)
Original: 1,396 lines
Optimized: ~400 lines (71% reduction)
Full Documentation: See reference/ directory