This document describes the new personalization features added to the GitHub Avatar Frame API project.
- Location: Added below the theme selection area in the "Customization & Discovery" section
- Functionality:
- Color picker input for selecting custom accent colors
- Quick color presets with 6 popular colors
- Reset button to restore default theme colors
- Real-time preview with CSS variables
- API Integration: Custom colors are passed via
accentColorparameter to the backend - Backend Processing: Uses Sharp.js to apply color tinting and modulation to frames
- Location: Next to the color picker in the "Customization & Discovery" section
- Functionality:
- Randomly selects one of the available themes
- 30% chance to also randomize accent color for extra variety
- Toast notifications for user feedback
- Disabled state when no themes are available
- User Experience:
- "✨ Surprise Style Loaded!" for theme-only randomization
- "🎲 Random Theme + Color Applied!" when both theme and color are randomized
- Design: Slide-in animation from the right
- Duration: 3 seconds auto-dismiss
- Styling: Matches the app's design system with proper dark/light mode support
- Usage: Provides feedback for random theme selection and color reset actions
- Added state management for
customAccentColor,originalThemeColor, and toast notifications - Updated API URL generation to include accent color parameter
- Enhanced UI with responsive design for mobile and desktop
- Added CSS animations for toast notifications
- Added
accentColorquery parameter handling - Implemented color processing using Sharp.js:
- Hex to RGB conversion
- Color tinting with custom colors
- Brightness and saturation modulation for better visual results
- Updated
/api/framed-avatar/{username}to acceptaccentColorparameter - Example:
?theme=minimal&accentColor=%23ff6b6b&size=256
User Interface
├── Theme Selection (existing)
├── Custom Color Picker (new)
│ ├── Color Input Field
│ ├── Quick Color Presets
│ └── Reset Button
├── Random Theme Generator (new)
│ ├── Random Theme Selection
│ └── Optional Random Color (30% chance)
└── Toast Notifications (new)
API Request
├── theme: selected theme
├── accentColor: custom color (optional)
├── size, canvas, shape, radius (existing)
└── style (existing)
Backend Processing
├── Fetch GitHub Avatar
├── Load Theme Frame
├── Apply Custom Color Tint (if provided)
│ ├── Convert hex to RGB
│ ├── Apply color modulation
│ └── Enhance brightness/saturation
└── Composite Final Image
Response
└── Framed Avatar with Custom Colors
Six predefined colors for easy selection:
- Purple:
#7c3aed - Pink:
#ec4899 - Orange:
#f97316 - Green:
#10b981 - Blue:
#3b82f6 - Violet:
#8b5cf6
- Color picker and controls adapt to mobile screens
- Proper spacing and alignment across different screen sizes
- Touch-friendly button sizes
- Proper ARIA labels and tooltips
- Keyboard navigation support
- Color contrast compliance
- Save custom color combinations
- Export/import color themes
- Color history for recently used colors
- Advanced color picker with HSL/HSV support
- Theme preview with custom colors before generation
- Select a theme (e.g., "minimal")
- Click the color picker and choose a custom color
- Generate the avatar with the custom accent color
- Use the quick color presets for instant color changes
- Colors are applied immediately without opening the color picker
- Click "🎲 Random Theme" to discover new themes
- Sometimes includes random accent colors for extra variety
- Toast notification confirms the selection
- When a custom color is selected, a "↻ Reset" button appears
- Click to restore the original theme colors
- Toast notification confirms the reset