Function: color-values-from-color-spec

color-values-from-color-spec is a function defined in xfaces.c.

Signature

(color-values-from-color-spec SPEC)

Documentation

Parse color SPEC as a numeric color and return (RED GREEN BLUE).

This function recognizes the following formats for SPEC:

 #RGB, where R, G and B are hex numbers of equal length, 1-4 digits each.
 rgb:R/G/B, where R, G, and B are hex numbers, 1-4 digits each.
 rgbi:R/G/B, where R, G and B are floating-point numbers in [0,1].

If SPEC is not in one of the above forms, return nil.

Each of the 3 integer members of the resulting list, RED, GREEN, and BLUE, is normalized to have its value in [0,65535].

Probably introduced at or before Emacs version 28.1.

Source Code

// Defined in /usr/src/emacs/src/xfaces.c
{
  CHECK_STRING (spec);
  unsigned short r, g, b;
  return (parse_color_spec (SSDATA (spec), &r, &g, &b)
          ? list3i (r, g, b)
          : Qnil);
}