Web-Safe 216 Nearest Index
Quantize encoded normalized RGB to 6-level web-safe cube, half-up channel ties and explicit red-major index; legacy palette reduction, not modern browser display safety or perceptual nearest match.
Description
The legacy web-safe palette is a six-level RGB cube.
The legacy web-safe palette is a six-level RGB cube. Channel rounding gives an explicit red-major index.1
Enter three encoded normalized RGB channels 0–1. Quantize each with half-up ties; return normalized palette RGB, uppercase six-digit HEX and index 0–215.
When to use Web-Safe 216 Nearest Index
Use Web-Safe 216 Nearest Index when you need to evaluate the supplied records under the calculation and evidence rules below. No modern display-safety or perceptually nearest-color guarantee is implied.
Prepare colors in the stated color space and scale. Use encoded RGB fractions, linear RGB, Lab, xy, byte values or ink percentages exactly as requested; supply caller tolerances and reference conditions.
How to use Web-Safe 216 Nearest Index and understand its results
- Prepare colors in the stated color space and scale. Use encoded RGB fractions, linear RGB, Lab, xy, byte values or ink percentages exactly as requested; supply caller tolerances and reference conditions.
- Enter rgbChannels using the field table and calculation rules, then run the tool.
- Read webSafeRgb, webSafeHex, redMajorWebSafeIndex. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| rgbChannels | Rgb channels | list of number | Required |
Enter three encoded normalized RGB channels 0–1. Quantize each with half-up ties; return normalized palette RGB, uppercase six-digit HEX and index 0–215.
level_i=round(5×channel_i); index=36Rlevel+6Glevel+Blevel Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| webSafeRgb | Web safe rgb | list of number |
| webSafeHex | Web safe hex | string |
| redMajorWebSafeIndex | Red major web safe index | number |
{
"input": {
"rgbChannels": [
1,
0.1,
0
]
},
"output": {
"webSafeRgb": [
1,
0.2,
0
],
"webSafeHex": "#FF3300",
"redMajorWebSafeIndex": 186
}
} Limitations and assumptions
No modern display-safety or perceptually nearest-color guarantee is implied.
Numeric inputs, where present, must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Numeric lists are limited to 10,000 entries; string lists to 128 strings of at most 128 characters each. The rules above may impose smaller limits. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use ANSI 256 Index From RGB: A canonical xterm palette combines 16 base colors, a 216-color cube and 24 grays. Actual terminal themes can change the base entries. For a complementary task, use E-Ink 16-Level Grayscale Map: Sixteen-level grayscale quantization needs a declared code polarity. Reconstructed gray is independent of that device convention.
References
-
Web-Safe 216 Nearest Index — tool.io
Similar or alternative tools
- ANSI 256 Index From RGB
A canonical xterm palette combines 16 base colors, a 216-color cube and 24 grays. Actual terminal themes can change the base entries.
- E-Ink 16-Level Grayscale Map
Sixteen-level grayscale quantization needs a declared code polarity. Reconstructed gray is independent of that device convention.