QuadCol
About
QuadCol is a color palette generator that creates a 4-color palette from a single base hex color. It uses the OKLab perceptually uniform color space to generate complementary colors with consistent perceptual brightness.
Given a base color, QuadCol generates:
- A lighter variant
- A medium variant
- The original base color
- A darker variant
The generated palette is rendered as an interactive HTML page displaying color swatches with hex and RGB values, along with CSS custom properties (variables) for easy integration into stylesheets.
Dependencies
coloraide - A Python color library used to convert hex colors to the OKLab perceptually uniform color space, adjust lightness values for consistent color variants, and convert back to sRGB for hex and RGB output formats. This ensures the generated palette maintains visual harmony and perceptual consistency.
Running From Source
These instructions are for Linux or macOS environments.
Prerequisites
If you're on Linux and encounter a Python venv setup error, install the required package:
sudo apt install python3.12-venv
Setup Steps
1. Create a virtual environment (one-time setup)
python3 -m venv .venv
2. Activate the virtual environment (required each time you open a terminal)
source .venv/bin/activate
3. Install dependencies (one-time setup)
pip install coloraide
4. Run QuadCol
python3 quadcol.py <base_color> [output_file]
Examples:
python3 quadcol.py FF6B6B— generatesoutput.htmlpython3 quadcol.py #FF6B6B mypalette.html— saves tomypalette.html
Single Executable
If you want to use QuadCol without keeping a virtual environment active, or you want a cleaner developer workflow, bundle it into a single executable and put it on your PATH.
This is the easiest option for day-to-day use because it avoids ad-hoc files in the repo and lets you run quadcol from anywhere.
Why use the executable build?
- Keeps the project root cleaner
- Avoids repeated setup churn from generated files
- Makes the command easier to invoke in scripts and terminal sessions
- Gives you a stable, shareable local tool
Build Steps
These instructions are for Linux or macOS. You need to build the executable separately for each operating system you target.
The virtual environment from the previous section is reused here. If it does not exist yet, create and activate it first.
1. Activate the virtual environment
source .venv/bin/activate
2. Install the required build tools
pip install coloraide
pip install pyinstaller
3. Generate the PyInstaller spec file
This creates a configuration matching your main entry script:
pyi-makespec --onefile quadcol.py
4. Update the spec file so bundled resources are included
Open quadcol.spec and find the datas=[] entry inside the Analysis block. Replace it with:
datas=[
("resources/*", "resources"),
],
This ensures the app can find the resource files it needs when bundled as a single executable.
5. Build the executable
pyinstaller quadcol.spec
This creates the binary in the project directory at:
dist/quadcol
6. Run it directly or install it on your PATH
Run it from the build output folder:
./dist/quadcol <base_color> [output_file]
Or install it somewhere convenient on your PATH:
chmod +x dist/quadcol
cp dist/quadcol ~/.local/bin/quadcol
Then you can run it like this:
quadcol <base_color> [output_file]
If ~/.local/bin is not already on your PATH, add it to your shell profile before using the command globally.
Example usage
quadcol AE5F38 palette-orange.html
quadcol #FF6B6B mypalette.html
Example Palettes
Here are a few palettes that I regularly use, and you might be interested in:
Palette Blue
python3 quadcol.py 009BFF palette-blue.html
./quadcol 009BFF palette-blue.html
Here is the generated output
Palette Green
python3 quadcol.py 5AB33B palette-green.html
./quadcol 5AB33B palette-green.html
Here is the generated output
Palette Orange
python3 quadcol.py AE5F38 palette-orange.html
./quadcol AE5F38 palette-orange.html
Here is the generated output
Palette Slate
python3 quadcol.py 4C566A palette-slate.html
./quadcol 4C566A palette-slate.html
Here is the generated output
Palette Terracotta
python3 quadcol.py BC5215 palette-terracotta.html
./quadcol BC5215 palette-terracotta.html
Here is the generated output
Palette Moss
python3 quadcol.py 66800B palette-moss.html
./quadcol 66800B palette-moss.html
Here is the generated output
Palette Lavender
python3 quadcol.py 8A4FFF palette-lavender.html
./quadcol 8A4FFF palette-lavender.html
Here is the generated output
Palette Ocean
python3 quadcol.py 205EA6 palette-ocean.html
./quadcol 205EA6 palette-ocean.html
Here is the generated output