Skip to content

Commit 608fdbb

Browse files
authored
Merge pull request #4 from clstaudt:theme
Theme
2 parents e8d2b63 + f8ced99 commit 608fdbb

File tree

6 files changed

+613
-45
lines changed

6 files changed

+613
-45
lines changed

assets/logo.png

457 KB
Loading

ragadoc/themes/README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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! 🎨

ragadoc/themes/classic.css

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* Classic Theme for Streamlit Apps
2+
* A clean, professional light theme
3+
*/
4+
5+
:root {
6+
--primary-blue: #0066cc;
7+
--accent-blue: #0080ff;
8+
--light-bg: #ffffff;
9+
--surface-bg: #f8f9fa;
10+
--elevated-bg: #ffffff;
11+
--text-primary: #212529;
12+
--text-secondary: #6c757d;
13+
--border-color: #dee2e6;
14+
--hover-color: #e9ecef;
15+
}
16+
17+
.stApp {
18+
background: var(--light-bg);
19+
color: var(--text-primary);
20+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
21+
}
22+
23+
h1 {
24+
color: var(--primary-blue) !important;
25+
font-weight: 700 !important;
26+
}
27+
28+
.stButton > button {
29+
background: var(--primary-blue) !important;
30+
color: white !important;
31+
border: none !important;
32+
border-radius: 6px !important;
33+
padding: 0.5rem 1rem !important;
34+
}
35+
36+
.stButton > button:hover {
37+
background: var(--accent-blue) !important;
38+
transform: translateY(-1px) !important;
39+
}
40+
41+
.stSelectbox > div > div,
42+
.stTextInput > div > div > input {
43+
background: white !important;
44+
border: 1px solid var(--border-color) !important;
45+
border-radius: 4px !important;
46+
color: var(--text-primary) !important;
47+
}
48+
49+
.css-1d391kg {
50+
background: var(--surface-bg) !important;
51+
border-right: 1px solid var(--border-color);
52+
}

0 commit comments

Comments
 (0)