Skip to content

Main content

Random Categorical Color Palette Generator

Assign generated distinct hex colors to distinct supplied category labels under a caller OKLab distance threshold and finite attempt limit; assignments preserve category order and do not imply universal distinguishability.

Loading tool…

Description

Assign generated distinct hex colors to distinct supplied category labels under a caller OKLab distance threshold and finite attempt limit; assignments preserve category order and do not imply universal distinguishability.

Procedural artwork expresses a visual idea through coordinates, repeated motifs, colors, or explicit placement constraints. A coordinate plan can be checked and reproduced before rendering, while physical material behavior and fabrication require separate information.

Assign generated distinct hex colors to distinct supplied category labels under a caller OKLab distance threshold and finite attempt limit; assignments preserve category order and do not imply universal distinguishability.

When to use this tool

Use this generator to create reproducible categorical color palette cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply categories, minimumDistance, maximumAttempts in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read assignments, pairDistances, minimumPairDistance, attempts. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.

Generate distinct RGB colors separated by the requested Euclidean Oklab threshold, assign them to the supplied category order, and return distance diagnostics and attempts.1

Input fieldMeaning and unitsAccepted input
categoriesCategoriesRequired. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 128.; minimum items 2; maximum items 32.
minimumDistanceMinimum DistanceRequired. Finite number; minimum 0.
maximumAttemptsMaximum AttemptsRequired. Safe integer; minimum 2; maximum 8192.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
assignmentsAssignmentsRequired. Array of Object; no unknown keys.; minimum items 2; maximum items 32.
assignments[].categoryCategoryRequired. Text; minimum UTF-16 length 1; maximum UTF-16 length 128.
assignments[].colorColorRequired. Text; minimum UTF-16 length 7; maximum UTF-16 length 7.
pairDistancesPair DistancesRequired. Array of Array of Finite number; minimum 0.; minimum items 2; maximum items 32.; minimum items 2; maximum items 32.
minimumPairDistanceMinimum Pair DistanceRequired. Finite number; minimum 0.
attemptsAttemptsRequired. Safe integer; minimum 2; maximum 8192.
randomnessReplay source and normalized 32-bit seed, or null seed for an advancing context source.Required. Object; no unknown keys.
randomness.seedOptional safe-integer replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "categories": [
      "North",
      "South",
      "East"
    ],
    "minimumDistance": 0.08,
    "maximumAttempts": 256,
    "seed": 42
  },
  "output": {
    "pairDistances": [
      [
        0,
        0.23223162360349597,
        0.3871507399281652
      ],
      [
        0.23223162360349597,
        0,
        0.34629109143736014
      ],
      [
        0.3871507399281652,
        0.34629109143736014,
        0
      ]
    ],
    "minimumPairDistance": 0.23223162360349597,
    "attempts": 3,
    "assignments": [
      {
        "category": "North",
        "color": "#99E1EF"
      },
      {
        "category": "South",
        "color": "#72C32B"
      },
      {
        "category": "East",
        "color": "#DA3B32"
      }
    ],
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • Category IDs must be distinct. Oklab separation is not a contrast guarantee or protection against every color-vision deficiency. Finite candidate search can fail even when a suitable palette exists.
  • A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Categorical Color Palette Generator — tool.io

Similar or alternative tools

  • Random Color Vision Deficiency Palette Generator

    Generate distinct sRGB hex colors separated by a caller threshold in OKLab after each existing full-severity protan/deutan/tritan simulation, with a finite attempt limit and no individual accessibility guarantee.

  • Random Color Wheel Generator

    Generate an HSL wheel with a random hue offset, explicit saturation/lightness, annular sector geometry and portable SVG; unlike a hue palette, the output defines a complete circular layout.