2026-08-31 01:14:37 +05:30
2026-08-31 00:44:14 +05:30
2026-08-31 01:14:37 +05:30
2026-08-31 00:44:14 +05:30
2026-08-31 00:40:24 +05:30
2026-08-31 00:44:14 +05:30
2026-08-31 00:44:14 +05:30
2026-08-31 01:14:37 +05:30

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 — generates output.html
  • python3 quadcol.py #FF6B6B mypalette.html — saves to mypalette.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

Generated Output

Palette Green

python3 quadcol.py 5AB33B palette-green.html

./quadcol 5AB33B palette-green.html

Generated Output

Palette Orange

python3 quadcol.py AE5F38 palette-orange.html

./quadcol AE5F38 palette-orange.html

Generated Output

Palette Slate

python3 quadcol.py 4C566A palette-slate.html

./quadcol 4C566A palette-slate.html

Generated Output

Palette Crimson

python3 quadcol.py AF3029 palette-crimson.html

./quadcol AF3029 palette-crimson.html

Generated Output

Palette Moss

python3 quadcol.py 66800B palette-moss.html

./quadcol 66800B palette-moss.html

Generated Output

Palette Lavender

python3 quadcol.py 8A4FFF palette-lavender.html

./quadcol 8A4FFF palette-lavender.html

Generated Output

Palette Ocean

python3 quadcol.py 205EA6 palette-ocean.html

./quadcol 205EA6 palette-ocean.html

Generated Output

Palette Terracotta

python3 quadcol.py BC5215 palette-terracotta.html

./quadcol BC5215 palette-terracotta.html

Generated Output

Palette Orche

python3 quadcol.py AD8301 palette-orche.html

./quadcol AD8301 palette-orche.html

Generated Output

Palette Magenta

python3 quadcol.py A02F6F palette-magenta.html

./quadcol A02F6F palette-magenta.html

Generated Output

S
Description
A color palette generator that creates a 4-color palette from a single base hex color.
Readme Apache-2.0
126 KiB
Languages
Python 56.1%
Go Template 43.9%