|
| 1 | +# 🎨 Theme System |
| 2 | + |
| 3 | +This directory contains CSS theme files for the ragadoc Streamlit application. |
| 4 | + |
| 5 | +## Available Themes |
| 6 | + |
| 7 | +- **darkstreaming.css** - Modern dark theme with streaming-inspired design and green accents |
| 8 | +- **classic.css** - Clean, professional light theme with blue accents |
| 9 | + |
| 10 | +## How to Use |
| 11 | + |
| 12 | +### Default Usage |
| 13 | +The app uses the `darkstreaming` theme by default: |
| 14 | + |
| 15 | +```python |
| 16 | +from ragadoc import setup_streamlit_config |
| 17 | +setup_streamlit_config() # Uses darkstreaming theme |
| 18 | +``` |
| 19 | + |
| 20 | +### Switch Themes |
| 21 | +To use a different theme: |
| 22 | + |
| 23 | +```python |
| 24 | +from ragadoc import setup_streamlit_config |
| 25 | +setup_streamlit_config(theme="classic") # Uses classic theme |
| 26 | +``` |
| 27 | + |
| 28 | +### Environment-Based Theme Selection |
| 29 | +You can also set themes via environment variables: |
| 30 | + |
| 31 | +```bash |
| 32 | +export RAGADOC_THEME=classic |
| 33 | +streamlit run app.py |
| 34 | +``` |
| 35 | + |
| 36 | +## Creating New Themes |
| 37 | + |
| 38 | +### 1. Create a CSS File |
| 39 | +Create a new `.css` file in this directory (e.g., `mytheme.css`): |
| 40 | + |
| 41 | +```css |
| 42 | +/* My Custom Theme */ |
| 43 | +:root { |
| 44 | + --primary-color: #your-color; |
| 45 | + --bg-color: #your-bg; |
| 46 | + /* Define your variables */ |
| 47 | +} |
| 48 | + |
| 49 | +.stApp { |
| 50 | + background: var(--bg-color); |
| 51 | + /* Your styling */ |
| 52 | +} |
| 53 | + |
| 54 | +/* Style other components */ |
| 55 | +.stButton > button { |
| 56 | + background: var(--primary-color); |
| 57 | +} |
| 58 | +``` |
| 59 | + |
| 60 | +### 2. Use Your Theme |
| 61 | +```python |
| 62 | +setup_streamlit_config(theme="mytheme") |
| 63 | +``` |
| 64 | + |
| 65 | +## Theme Structure |
| 66 | + |
| 67 | +### CSS Variables |
| 68 | +Use CSS variables for easy customization: |
| 69 | +- `--primary-color` - Main brand color |
| 70 | +- `--accent-color` - Secondary accent color |
| 71 | +- `--bg-color` - Background color |
| 72 | +- `--text-color` - Text color |
| 73 | +- `--border-color` - Border color |
| 74 | + |
| 75 | +### Key Streamlit Classes |
| 76 | +Important CSS classes to style: |
| 77 | +- `.stApp` - Main application container |
| 78 | +- `.stButton > button` - Buttons |
| 79 | +- `.stSelectbox > div > div` - Select boxes |
| 80 | +- `.stTextInput > div > div > input` - Text inputs |
| 81 | +- `.stChatMessage` - Chat messages |
| 82 | +- `.css-1d391kg` - Sidebar |
| 83 | + |
| 84 | +## Fallback System |
| 85 | + |
| 86 | +If a theme file doesn't exist, the system automatically falls back to a basic dark theme to ensure the app always has styling. |
| 87 | + |
| 88 | +## Best Practices |
| 89 | + |
| 90 | +1. **Use CSS Variables** - Makes themes easy to customize |
| 91 | +2. **Keep It Focused** - Only style what you need to change |
| 92 | +3. **Test Responsiveness** - Include mobile-friendly styles |
| 93 | +4. **Comment Your Code** - Help others understand your theme |
| 94 | +5. **Follow Naming Conventions** - Use descriptive theme names |
| 95 | + |
| 96 | +## Contributing |
| 97 | + |
| 98 | +To contribute a new theme: |
| 99 | +1. Create a new CSS file following the naming convention |
| 100 | +2. Test it thoroughly with the app |
| 101 | +3. Add it to the list of available themes in this README |
| 102 | +4. Submit a pull request |
| 103 | + |
| 104 | +Happy theming! 🎨 |
0 commit comments