COLOR Function (LibreOffice Calc)
Calculate LibreOffice COLOR values from RGB and alpha components. Follow exact integer examples, decode the channels and distinguish numbers from formatting.
Verification status: 8 source-derived examples were checked against LibreOffice 26.8 Help and the complete 26.8.1.1 callback. Integer packing and decoding were independently calculated; no native or color-rendering test. How formula examples are checked
Quick answer: COLOR(255;0;0) gives 16711680 in the inspected arithmetic. COLOR returns a number; it does not apply a font, background or cell style.
Availability and version history
- Introduced: LibreOffice 4.4, explicitly stated in function-specific Help.
- Supported in: 26.8 Help and 26.8.1.1 registration; no retirement is established.
- Scope: Desktop Calc, English formulas. The documented
ORG.LIBREOFFICE.COLORnamespace is outside OpenFormula 1.3. - Checked: October 14, 2026. Documentation and the complete callback were inspected. Integer arithmetic was independently checked; color rendering was not executed.
What COLOR does
The function combines red, green, blue and an optional alpha channel into one nonnegative numeric value. The inspected calculation is alphaĂ—16777216 + redĂ—65536 + greenĂ—256 + blue. Each channel contributes a different base-256 position.
For integer channels from 0 through 255, the largest packed value is 4294967295. These integers fit exactly within the usual binary64 integer precision. That arithmetic fact does not establish how another application or a particular display interprets the number as a color. Function Help.
Syntax and arguments
COLOR(Red; Green; Blue [; Alpha])
Square brackets mark an optional argument; do not type them. Red, Green and Blue are required. Alpha is optional and defaults to zero in the callback. Use integer component values from 0 through 255. Help describes zero alpha as transparent and 255 as opaque; those are documented color meanings, not observed rendering in this guide. For each supplied channel, the implementation applies approximate floor before checking the 0–255 limits. Positive ordinary fractions therefore round downward; do not generalize the Help word “truncated” to negative fractions.
Source-derived examples
These are independent integer calculations using the inspected packing formula; no native application result is claimed.
| Formula | Source-derived result or interpretation | Context |
|---|---|---|
=COLOR(0;0;0) |
0 | All three required channels are zero; omitted alpha is zero. |
=COLOR(255;0;0) |
16711680 | Red occupies the 65536 position. |
=COLOR(0;255;0) |
65280 | Green occupies the 256 position. |
=COLOR(0;0;255;0) |
255 | The low-order blue channel, with explicit zero alpha. |
=COLOR(255;255;255;1) |
33554431 | The same numeric example appears in official Help. |
=COLOR(0;0;255;255) |
4278190335 | Maximum alpha plus maximum blue. |
=COLOR(255;255;255;255) |
4294967295 | All four channels at their maximum. |
=COLOR(1.9;2.9;3.9;4.9) |
67174915 | The inspected ordinary-fraction normalization gives channels 1,2,3,4. |
Practical worksheet
Put Red=12 in A2, Green=34 in B2, Blue=56 in C2 and Alpha=78 in D2. The formula =COLOR(A2;B2;C2;D2) in E2 has the independent arithmetic result 1309418040. Record the channel order alongside the value; a bare integer is easy to misinterpret when passed to another system.
Changing only C2 from 56 to 57 increases E2 by 1. Changing only B2 from 34 to 35 increases it by 256. These differences are useful checks of the component positions. They do not show that any cell appearance has changed: formatting requires a separate interface or rule.
Advanced interpretation and checks
For a valid packed nonnegative integer N, recover blue with MOD(N;256), green with MOD(QUOTIENT(N;256);256), red with MOD(QUOTIENT(N;65536);256) and alpha with QUOTIENT(N;16777216). With N=1309418040, these yield 56,34,12,78 respectively. The decoding identities depend on N being one of the valid packed integers.
The printed decimal value is not a CSS color string or a guarantee of another product’s byte order. For example, the positional number for alpha=1 and RGB=255,255,255 is 33554431. Keep alpha’s high-order position explicit instead of guessing a hexadecimal text convention from the argument order. Inspected implementation.
Boundaries and troubleshooting
The source checks each normalized channel and rejects values outside 0–255. Help illustrates an excessive blue component with COLOR(0;0;400;0) and Err:502. That error is documented, not a native test here. The examples stay within small ordinary values and do not claim special treatment of numbers extremely close to an integer.
Help says the result depends on the computer’s color system, while the inspected callback has a fixed numerical packing formula and no color-system branch. This guide therefore verifies the arithmetic and leaves visual interpretation to the receiving system. Neither rendering, alpha compositing nor operating-system color management was executed.
Related functions
Official evidence and checking scope
The inspected version is LibreOffice 26.8.1.1 source; it was not executed. The exact numbers establish component arithmetic, not formatting or cross-product byte-order compatibility.