Palette Swatch Row Position
Place an explicit palette swatch index on a row-major grid with physical size and gaps; no renderer or color-space behavior.
Description
Place an explicit palette swatch index on a row-major grid with physical size and gaps; no renderer or color-space behavior.
A palette swatch grid maps a linear entry index to row, column and top-left position. Gaps contribute to each repeated pitch.
When to use this tool
Place an explicit palette swatch index on a row-major grid with physical size and gaps; no renderer or color-space behavior.
- Prepare the supplied index, columns, swatchWidth, swatchHeight, gapX, gapY fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter index, columns, swatchWidth, swatchHeight, gapX, gapY. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.row, result.column, result.x, result.y. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require a nonnegative integer index, columns 1 to 128, positive swatch dimensions and nonnegative gaps. row is floor(index/columns), column is index modulo columns, and coordinates multiply those positions by swatch extent plus gap.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| index | index. | Integer from 0 to 1e9 inclusive |
| columns | columns. | Integer from 1 to 128 inclusive |
| swatchWidth | swatch width. | Finite number; greater than zero |
| swatchHeight | swatch height. | Finite number; greater than zero |
| gapX | gap x. | Finite number |
| gapY | gap y. | Finite number |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.row | The row value under the stated formula or text convention. |
| result.column | The column value under the stated formula or text convention. |
| result.x | The x value under the stated formula or text convention. |
| result.y | The y value under the stated formula or text convention. |
{
"input": {
"index": 5,
"columns": 3,
"swatchWidth": 10,
"swatchHeight": 8,
"gapX": 2,
"gapY": 1
},
"output": {
"result": {
"row": 1,
"column": 2,
"x": 24,
"y": 9
}
}
} Limitations and assumptions
- The origin is zero and units follow the dimensions supplied. No palette entries, rendered page or container fit are inspected.
- Palette records contain string id/name and exactly four RGBA bytes from zero through 255; at most 128 records are accepted. Duplicate IDs or names remain allowed unless this operation explicitly audits or rejects them.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- Lists are limited to 128 entries. JSON text must meet bounded size and depth checks, and numeric outputs beyond the safe finite magnitude are rejected. Exact large integers use decimal strings.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
Use actual rendering or a color-managed workflow when comparing perceived color and transparency. Index changes need corresponding updates to their consumers; name and role checks do not establish visual accessibility.
References
Similar or alternative tools
- Palette Adjacent Repeat Audit
Audit adjacent exact RGBA palette repeats, excluding RGB-only matches whose alpha differs; caller ordering is preserved.
- Palette Alpha Presence Summary
Count transparent, opaque and partially transparent RGBA palette byte entries; no compositing or color-space conversion.