A Firefox extension that displays inline color previews next to hex and RGB color codes.
-
🎨 Automatic Color Detection: Detects and displays color previews for:
- Hex colors with
#(e.g.,#FF5733,#abc,#FF5733AA) - Hex colors without
#(optional, e.g.,FF5733) - RGB/RGBA colors (optional, e.g.,
rgb(255, 87, 51),rgba(255, 87, 51, 0.5))
- Hex colors with
-
🌐 Flexible Site Management:
- Whitelist approach: only runs on sites you explicitly enable
- Quick toggle button for current website in header
- Enable entire websites (domains) or specific pages (full URLs)
- Disable specific pages while keeping website enabled
- Temporary show mode (until page reload)
- Download the latest
.xpifile from the Releases page - Open Firefox and navigate to
about:addons - Click the gear icon and select "Install Add-on From File..."
- Select the downloaded
.xpifile
-
Clone this repository:
git clone https://github.com/lzhecz/code-color-preview.git cd code-color-preview -
Open Firefox and navigate to
about:debugging -
Click "This Firefox" in the left sidebar
-
Click "Load Temporary Add-on"
-
Navigate to the extension folder and select
manifest.json
- Click the extension icon in your toolbar
- Make sure the extension is ON (toggle at top-right)
- Click the website name button at top-left to enable colors on the current site
- ✓ Green checkmark = enabled
- ✕ Red X = not enabled (default)
In the General tab:
- Detect colors without #: Enable to detect hex colors like
FF5733without the#prefix - Detect RGB/RGBA: Enable to detect colors in
rgb()andrgba()format
Quick Actions:
- Show on Current Page (Until Reload): Temporarily enable colors without saving
- Enable This Page: Add the specific URL to enabled list (overrides website setting)
- Disable This Page: Disable colors on this specific page only
Site List Tab shows three categories:
- Enabled Websites: Domains where extension runs (e.g.,
github.com) - Enabled Pages: Specific URLs (e.g.,
https://example.com/page.html) - Disabled Pages: Specific URLs where extension is blocked
Each list has a "Clear List" button for bulk removal.
When debug mode is enabled, you'll see:
[Color Preview Debug] Settings loaded: {...}
[Color Preview Debug] === Starting color preview scan ===
[Color Preview Debug] Processed X elements
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a Pull Request
- Firefox: 57+ (Tested on latest versions)
- Only works on sites you explicitly enable (whitelist approach by design)
- May not detect colors embedded in minified JavaScript or complex CSS
- RGB detection requires valid ranges (0-255 for each component)
- Hex without # detection only matches 6-character codes (to avoid false positives)
This extension:
- ✅ Runs entirely locally in your browser
- ✅ Does not collect or transmit any data
- ✅ Only accesses pages you explicitly enable
- ✅ Stores only your preferences in browser's local storage
- ✅ No external dependencies or API calls
- ✅ Open source - audit the code yourself!
Colors not showing up?
- Make sure the extension is ON (top-right toggle)
- Enable the current website (click the website button at top-left)
- Enable detection options if using hex without # or RGB colors
Too many or duplicate color boxes?
- This might be a bug - please report it!
- Try disabling and re-enabling the site
- Check if multiple overlapping code elements exist
https://github.com/lzhecz/code-color-preview
If you encounter any issues or have suggestions:
- Open an issue on GitHub Issues
- Include:
- Your Firefox version
- Steps to reproduce the problem
- Screenshots if applicable
- HTML section that contains problem if possible
- Console output if debug mode is enabled

