Spaces:
Runtime error
Runtime error
File size: 5,051 Bytes
719e71f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | # π€ Contributing to Colorspace Explorer
Thank you for your interest in contributing! This document provides guidelines for contributing to the project.
## Ways to Contribute
### 1. Report Bugs π
- Use the GitHub issue tracker
- Include steps to reproduce
- Provide screenshots if applicable
- Mention your OS and Python version
### 2. Suggest Features π‘
- Open an issue with the "enhancement" label
- Explain the educational value
- Provide examples or mockups if possible
### 3. Add New Colorspaces π¨
Good candidates:
- XYZ (CIE 1931)
- LCH (Lightness, Chroma, Hue)
- LUV
- HSL (alternative to HSV)
- Oklab (modern perceptual space)
### 4. Improve Documentation π
- Fix typos or unclear explanations
- Add more educational content
- Improve examples
- Translate documentation
### 5. Add Test Images πΌοΈ
- Standard test images
- Colorblind test patterns
- Images that demonstrate specific concepts
- Diverse content (people, nature, graphics)
## Development Setup
1. **Fork and clone**
```bash
git clone https://github.com/YOUR_USERNAME/colorspaces.git
cd colorspaces
```
2. **Set up environment**
```bash
make setup
```
3. **Make your changes**
- Edit `app.py` for functionality
- Update `README.md` for documentation
- Add images to `images/` folder
4. **Test locally**
```bash
make test
make run
```
5. **Commit and push**
```bash
git add .
git commit -m "Description of changes"
git push origin your-branch-name
```
6. **Create Pull Request**
- Go to GitHub
- Click "New Pull Request"
- Describe your changes
- Link any related issues
## Code Style Guidelines
### Python Code
- Follow PEP 8 style guide
- Use meaningful variable names
- Add docstrings to functions
- Keep functions focused and short
- Comment complex algorithms
### Streamlit UI
- Use clear, descriptive labels
- Include help text for sliders
- Provide informative captions
- Use emojis sparingly for visual interest
- Maintain consistent layout patterns
### Documentation
- Use clear, concise language
- Include code examples
- Add links to references
- Explain educational purpose
- Use proper Markdown formatting
## Adding a New Colorspace Tab
Here's a template for adding a new colorspace:
```python
def tab_new_colorspace():
"""Brief description of the colorspace."""
st.header("π¨ Colorspace Name")
st.markdown("""
**Brief description** with key properties:
- **Property 1**: Description
- **Property 2**: Description
- **Use cases**: When to use this space
""")
col1, col2 = st.columns([1, 2])
with col1:
st.subheader("Controls")
# Add interactive controls
param1 = st.slider("Parameter 1", min_val, max_val, default)
param2 = st.slider("Parameter 2", min_val, max_val, default)
# Show color swatch or visualization
# ...
with col2:
st.subheader("Image Analysis")
# Image selection and processing
images = get_available_images()
if images:
selected_img = st.selectbox("Select image:", images)
img = load_image(selected_img)
if img is not None:
# Process and display
# ...
st.markdown("---")
st.markdown("""
### π‘ Key Insights
- Point 1
- Point 2
- Applications
""")
```
Then add it to the main tabs:
```python
tabs = st.tabs([..., "New Colorspace"])
with tabs[N]:
tab_new_colorspace()
```
## Testing Guidelines
Before submitting:
1. **Functionality**
- [ ] All sliders work correctly
- [ ] Images load and display properly
- [ ] Conversions are mathematically correct
- [ ] No errors in console
2. **UI/UX**
- [ ] Layout looks good on different screen sizes
- [ ] Labels are clear and descriptive
- [ ] Help text is informative
- [ ] Before/after comparisons are intuitive
3. **Educational Value**
- [ ] Explanations are clear and accurate
- [ ] Key insights are provided
- [ ] Examples are relevant
- [ ] References are included
4. **Performance**
- [ ] Images resize appropriately
- [ ] No lag with sliders
- [ ] Matplotlib figures are closed
- [ ] Memory usage is reasonable
## Commit Message Guidelines
Use clear, descriptive commit messages:
- `feat: Add XYZ colorspace tab`
- `fix: Correct CMYK to RGB conversion formula`
- `docs: Update README with new features`
- `style: Improve layout of HSV tab`
- `refactor: Extract common image loading code`
- `test: Add test for LAB color difference`
## Questions?
- Open an issue for questions
- Tag maintainers for help
- Check existing issues first
## Code of Conduct
- Be respectful and inclusive
- Welcome newcomers
- Focus on constructive feedback
- Assume good intentions
- Keep discussions on-topic
## Recognition
Contributors will be acknowledged in:
- README.md
- Release notes
- Project documentation
Thank you for contributing! π
|