Documentation Index
Fetch the complete documentation index at: https://mintlify.com/SchroederNathan/theme-gen/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Theme Gen automatically encodes your theme into the URL, allowing you to share your exact color configuration with others. Simply copy the URL and send it - the recipient will see your theme instantly.URL Format
Theme URLs use two query parameters:colors- Compact hex representation of 5 core colorsmode- Eitherlightordark
Example URL
- Text:
#1a1a1a - Background:
#ffffff - Primary:
#3b82f6 - Container:
#f5f5f5 - Accent:
#8b5cf6 - Mode: Light
Color Encoding
Only 5 colors are encoded in the URL (the “core” colors):- border and muted - Mixed from text/background
- success, error, warning - Fixed hues with primary’s lightness
- on-colors - Calculated for contrast
- ring - Same as primary
Encoding Function
- Strips
#from each hex color - Joins with
-separator - Sets both
colorsandmodeparams - Uses
replaceState(notpushState) to avoid polluting history
The URL updates automatically on every theme change - you always have a shareable link.
URL Parsing
On page load, the app checks for theme parameters in the URL:- Parameter exists - URL has
colorsparam - Correct length - Exactly 5 hex values
- Valid hex - Each value is 6 hex digits (no
#)
Hydration on Load
Automatic Sync
Every time the theme changes, the URL is updated:- URL always reflects current state
- Every edit creates a new shareable URL
- Browser back/forward navigation is not affected (using
replaceState)
Sharing Workflow
- Customize your theme in the Theme Customizer
- Copy the URL from your browser’s address bar
- Send to recipient via any channel (email, Slack, etc.)
- Recipient opens link and sees your exact theme
- Recipient can customize further from your starting point
URL sharing creates a “fork” - the recipient gets their own copy that doesn’t affect your original.
URL vs. localStorage Priority
The loading priority is:- URL parameters (highest priority)
- localStorage saved theme
- Default light theme (fallback)
Derived Colors
The URL only contains 5 colors, but the full palette has 17 colors. Here’s how the rest are derived:Border and Muted
On-Colors
State Colors
These aren’t in the URL but are generated when the theme is loaded:Because state colors aren’t in the URL, customizations to them are not shared. Only the 5 core colors are preserved.
URL Length
The compact format keeps URLs short:- 6 chars × 5 colors = 30 chars
- 4 separators = 4 chars
- Mode parameter = ~11 chars
- Total: ~45 chars (well under URL length limits)
Security Considerations
The URL parser validates all inputs:- Invalid hex → Falls back to localStorage/defaults
- Wrong length → Falls back to localStorage/defaults
- Missing params → Falls back to localStorage/defaults
Browser History
The system usesreplaceState instead of pushState:
- No history pollution - Every color change doesn’t create a back button entry
- Current state only - The URL reflects the current theme, not a history trail
- Clean navigation - Back button works as expected, not back through every color tweak
Limitations
Not Included in URL
- State colors (success, error, warning) - Derived from defaults
- On-colors for state colors - Derived from state colors
- Ring color - Same as primary
- Lock states - Session-only, not persisted
- Saved themes - User-specific, stored in localStorage
Sharing Locked States
If you want to share a theme with specific locked colors for editing:- There’s no built-in mechanism for this
- The recipient will receive all colors unlocked
- They can manually lock colors after loading
Best Practices
- Share after finalizing - URL represents a snapshot, not live edits
- Test the link - Open in incognito to verify it works
- Add context - Tell recipients what you changed if sharing mid-design
- Use both modes - Share separate URLs for light and dark if both are customized
- Shorten if needed - Use a URL shortener for social media (though the URL is already compact)
Related Features
- Live Preview - What recipients see when they open your link
- Export - Alternative to sharing for one-way distribution
- Smart Shuffle - Generate new themes to share