Extract colours, fonts, and CSS from any website
Web Style Extractor analyses websites to extract their colour palettes and typography, then generates usable files for creating matching branded internal sites, wikis, and documentation. Perfect for maintaining consistent branding across your organisation's web properties.
Give it a website URL, and it will:
- Pull out all the colours used on the site
- Find all the fonts and typography
- Generate usable files you can actually use in your projects
Perfect for creating branded internal wikis or sites that match your organisation's main website. Extract the colours and fonts from your company's public site, then apply that theme to your internal documentation, wikis, or employee portals.
- Extracts colours from CSS stylesheets and computed styles
- Converts colours to modern OKLCH colour space for better perceptual uniformity
- Generates semantic colour mapping (primary, secondary, background, text)
- Creates dynamic colour variations using CSS relative colour syntax
- Provides visual colour swatches with accessibility information
- Identifies all font families from CSS rules and computed styles
- Automatically categorises fonts (serif, sans-serif, monospace, display)
- Generates fallback-aware font declarations
- Creates fluid typography scales using
clamp()
functions - Provides live font rendering previews in HTML output
- Detects and generates container query patterns
- Identifies CSS nesting structures
- Extracts existing CSS custom properties (variables)
- Creates systematic design token structures
- Supports cutting-edge CSS selectors (
:has()
,:is()
,:where()
)
- MediaWiki Templates: Ready-to-use documentation for wikis
- JSON Data: Structured format for APIs and automation
- Modern CSS: Production-ready stylesheets with OKLCH colours
- Tailwind Configuration: Drop-in config files with extracted palettes
- Design Tokens: Style Dictionary-compatible JSON format
- HTML Reports: Interactive documentation with live previews
- Traditional CSS: Standard CSS variables and utility classes
- Python 3.8 or higher
- Google Chrome browser (for computed style extraction)
# Clone the repository
git clone https://github.com/development-toolbox/development-toolbox-web-style-extractor.git
cd development-toolbox-web-style-extractor
# Install dependencies
pip install -r requirements.txt
requests
- HTTP requests for fetching web contentbeautifulsoup4
- HTML and CSS parsingcssutils
- CSS processing and manipulationselenium
- Web browser automation for computed styleswebdriver-manager
- Automatic Chrome WebDriver management
Extract styles from any website:
# Basic extraction (MediaWiki format)
python style_extractor.py https://github.com
# Generate JSON for API integration
python style_extractor.py https://github.com --output json
# Create Tailwind CSS configuration
python style_extractor.py https://github.com --output tailwind
# Generate design tokens
python style_extractor.py https://github.com --output design-tokens
After extraction, files are organised in the projects/
directory:
projects/
βββ github.com/
βββ styles.json # Main output file (format-dependent)
βββ metadata.txt # Extraction metadata and statistics
βββ README.md # Project documentation
βββ README.html # Interactive preview with live fonts
File: styles.mediawiki
Purpose: Documentation wikis and knowledge bases
== Style Guide for https://github.com ==
'''Body Background:''' rgb(13, 17, 23)
'''Primary Colours:''' #1f883d, #0757ba, #197935
{| class="wikitable"
|-
! Colour !! Value !! Usage
|-
| style='background-color: #1f883d' |
| <code>#1f883d</code>
| Primary success colour
|}
File: styles.json
Purpose: API integration and programmatic access
{
"url": "https://github.com",
"extraction_date": "2025-09-03T10:15:24Z",
"styles": {
"body_background": "rgb(13, 17, 23)",
"body_font": "-apple-system, BlinkMacSystemFont, \"Segoe UI\""
},
"colors": ["#ffffff", "#1f883d", "#0757ba"],
"fonts": ["SF Pro Display", "Helvetica Neue", "Arial"]
}
File: design-tokens.json
Purpose: Cross-platform design systems
{
"designSystem": {
"colors": {
"semantic": {
"primary": {
"value": "#1f883d",
"oklch": "oklch(32.7% 0.233 137.1deg)",
"type": "color",
"description": "Primary brand colour"
}
}
},
"typography": {
"fontSizes": {
"base": {
"value": "clamp(1rem, 2.5vw, 1.125rem)",
"static": "1rem",
"type": "fontSize.fluid"
}
}
}
}
}
File: tailwind.config.js
Purpose: Tailwind CSS projects
module.exports = {
theme: {
extend: {
colors: {
'github-green': '#1f883d',
'github-blue': '#0757ba',
'github-dark': '#0d1117'
},
fontFamily: {
'sans': ['-apple-system', 'BlinkMacSystemFont', 'Segoe UI']
}
}
}
}
python style_extractor.py https://example.com --project-name "Company Style Guide"
# Generate cutting-edge CSS with OKLCH colours and container queries
python style_extractor.py https://example.com --output modern-css
# Extract from multiple sites
python style_extractor.py https://github.com --output json
python style_extractor.py https://tailwindcss.com --output tailwind
python style_extractor.py https://figma.com --output design-tokens
Extract your company's website colours and fonts to create matching internal wikis, documentation sites, and employee portals. No more guessing at brand colours or hunting through CSS files.
Generate ready-to-paste MediaWiki templates with your organisation's exact colour scheme. Perfect for company wikis that need to match corporate branding.
Extract design tokens for automated build processes, generate CSS variables, and create Tailwind configurations for rapid prototyping.
Analyse competitor websites to understand their design choices, colour schemes, and typography systems.
Extract styles from existing sites and convert them to modern CSS formats for easier maintenance and updates.
- Extraction: Parses CSS stylesheets and computes live styles using Chrome WebDriver
- Conversion: Transforms colours to OKLCH colour space using advanced colour theory algorithms
- Classification: Categorises colours by usage context and semantic meaning
- Optimisation: Generates dynamic variations using CSS relative colour syntax
- Detection: Identifies font families from CSS rules and rendered elements
- Classification: Categorises fonts by type and usage (display, body, monospace)
- Optimisation: Creates fallback stacks and fluid typography scales
- Preview: Generates live font rendering in HTML outputs
- Template System: Uses Jinja2-style templating for consistent formatting
- Format Adaptation: Tailors content and instructions for each output format
- Validation: Ensures generated code is syntactically correct and production-ready
- Documentation: Creates comprehensive guides with usage examples
The tool uses Chrome in headless mode for computed style extraction. Ensure Chrome is installed and up-to-date.
Templates can be customised by modifying files in the templates/
directory.
Output formats are configured in format_configs.py
with format-specific content, capabilities, and usage instructions.
Chrome WebDriver Errors
# The tool automatically manages WebDriver installation
# Ensure Chrome browser is installed and accessible
Network Timeouts
# Some websites block automated requests
# The tool will fall back to basic CSS extraction when needed
Permission Errors
# Ensure write permissions for the projects/ directory
chmod 755 projects/
Enable detailed logging:
export PYTHONPATH=.
python -m logging.basicConfig level=DEBUG style_extractor.py
# Fork the repository on GitHub first, then:
git clone https://github.com/YOUR-USERNAME/development-toolbox-web-style-extractor.git
cd development-toolbox-web-style-extractor
# Add upstream remote
git remote add upstream https://github.com/development-toolbox/development-toolbox-web-style-extractor.git
# Install development dependencies
pip install -r requirements.txt
- Fork the repository on GitHub
- Clone your fork locally
- Create a branch for your feature:
git checkout -b my-new-feature
- Make your changes and test them
- Commit your changes:
git commit -am 'Add some feature'
- Push to your fork:
git push origin my-new-feature
- Create a Pull Request from your fork to the main repository
- Follow PEP 8 style guidelines
- Use type hints for function signatures
- Add docstrings for public methods
- Include unit tests for new features
# Run test suite
python -m pytest tests/
# Test specific output format
python style_extractor.py https://example.com --output json
- Added comprehensive format-specific configuration system
- Improved OKLCH colour space conversion accuracy
- Enhanced design token generation with Style Dictionary compatibility
- Added fluid typography with clamp() function support
- Implemented professional UK English documentation
- Fixed version handling and removed premature version claims
- Added design tokens output format
- Implemented Tailwind CSS configuration generation
- Enhanced colour extraction accuracy
- Added HTML preview with live font rendering
- Initial release
- Basic colour and font extraction
- MediaWiki template generation
- JSON output format
MIT Licence. See LICENCE
file for details.
For issues, feature requests, or questions:
- Create an issue on GitHub
- Review the troubleshooting guide above
- Check existing documentation in
docs/
Built with modern web standards and professional development practices.