Difference between revisions of "Reference:Colors.inc"

From POV-Wiki
Jump to navigation Jump to search
m (removed obsolete passage)
(→‎Color macros: CIELAB and CIEXYZ conversion macros)
Line 28: Line 28:
 
macros included in colors.inc that converts between a few different types of
 
macros included in colors.inc that converts between a few different types of
 
color spaces.</p>
 
color spaces.</p>
<p>The three supported color spaces:</p>
+
<p>The supported color spaces:</p>
 
<ul>
 
<ul>
 
<li><code>RGB</code> = &lt; Red, Green, Blue, Filter, Transmit &gt;</li>
 
<li><code>RGB</code> = &lt; Red, Green, Blue, Filter, Transmit &gt;</li>
 
<li><code>HSL</code> = &lt; Hue, Saturation, Lightness, Filter, Transmit &gt;</li>
 
<li><code>HSL</code> = &lt; Hue, Saturation, Lightness, Filter, Transmit &gt;</li>
 
<li><code>HSV</code> = &lt; Hue, Saturation, Value, Filter, Transmit &gt;</li>
 
<li><code>HSV</code> = &lt; Hue, Saturation, Value, Filter, Transmit &gt;</li>
 +
<li><code>XYZ</code> = &lt; X, Y, Z, Filter, Transmit &gt; (CIEXYZ; {{New}} in 3.7.1)</li>
 +
<li><code>Lab</code> = &lt; Lightness L*, Chroma a*, Chroma b* &gt; (more accurately L*a*b*, CIELAB; {{New}} in 3.7.1)</li>
 
</ul>
 
</ul>
 
<p class="Note"><strong>Note:</strong> The Hue parameter is given in degrees.</p>
 
<p class="Note"><strong>Note:</strong> The Hue parameter is given in degrees.</p>
Line 59: Line 61:
 
{{#indexentry:include files, CRGB2HSV}}
 
{{#indexentry:include files, CRGB2HSV}}
 
<p><code>CRGB2HSV(Color)</code>: Converts a color given in <code>RGB</code> space to one in <code>HSV</code> space.</p>
 
<p><code>CRGB2HSV(Color)</code>: Converts a color given in <code>RGB</code> space to one in <code>HSV</code> space.</p>
 +
<p>Parameters:</p>
 +
<ul>
 +
<li><code>Color</code> = <code>RGB</code> color to be converted.</li>
 +
</ul>
 +
 +
{{#indexentry:include files, CXYZ2RGB}}
 +
<p><code>CXYZ2RGB(Color)</code>: Converts a color given in <code>XYZ</code> space to one in <code>RGB</code> space.</p>
 +
<p>Parameters:</p>
 +
<ul>
 +
<li><code>Color</code> = <code>XYZ</code> color to be converted.</li>
 +
</ul>
 +
 +
{{#indexentry:include files, CRGB2XYZ}}
 +
<p><code>CRGB2XYZ(Color)</code>: Converts a color given in <code>RGB</code> space to one in <code>XYZ</code> space.</p>
 +
<p>Parameters:</p>
 +
<ul>
 +
<li><code>Color</code> = <code>RGB</code> color to be converted.</li>
 +
</ul>
 +
 +
{{#indexentry:include files, CLab2RGB}}
 +
<p><code>CLab2RGB(Color,WhiteXYZ)</code>: Converts a color given in <code>Lab</code> space to one in <code>RGB</code> space.</p>
 +
<p>Parameters:</p>
 +
<ul>
 +
<li><code>Color</code> = <code>Lab</code> color to be converted.</li>
 +
<li><code>WhiteXYZ</code> = <code>XYZ</code> color of the chosen L*a*b* variant's reference white point.</li>
 +
</ul>
 +
 +
{{#indexentry:include files, CRGB2Lab}}
 +
<p><code>CRGB2Lab(Color,WhiteXYZ)</code>: Converts a color given in <code>RGB</code> space to one in <code>Lab</code> space.</p>
 +
<p>Parameters:</p>
 +
<ul>
 +
<li><code>Color</code> = <code>RGB</code> color to be converted.</li>
 +
<li><code>WhiteXYZ</code> = <code>XYZ</code> color of the chosen L*a*b* variant's reference white point.</li>
 +
</ul>
 +
 +
{{#indexentry:include files, CLab2RGB_D65}}
 +
<p><code>CLab2RGB_D65(Color)</code>: Converts a color given in <code>Lab</code> space (using D65 as reference white point) to one in <code>RGB</code> space.</p>
 +
<p>Parameters:</p>
 +
<ul>
 +
<li><code>Color</code> = <code>Lab</code> color to be converted.</li>
 +
</ul>
 +
 +
{{#indexentry:include files, CRGB2Lab_D65}}
 +
<p><code>CRGB2Lab_D65(Color)</code>: Converts a color given in <code>RGB</code> space to one in <code>Lab</code> space (using D65 as reference white point).</p>
 
<p>Parameters:</p>
 
<p>Parameters:</p>
 
<ul>
 
<ul>
 
<li><code>Color</code> = <code>RGB</code> color to be converted.</li>
 
<li><code>Color</code> = <code>RGB</code> color to be converted.</li>
 
</ul>
 
</ul>

Revision as of 00:39, 22 December 2016

This file is mainly a list of predefined colors, but also has a few color manipulation macros.

Predefined colors

This file contains 127 predefined colors that you can use in your scenes. Simply #include them in your scene file to use them:

  #include "colors.inc"

These basic colors:

  • Red
  • Green
  • Blue
  • Yellow
  • Cyan
  • Magenta
  • Clear
  • White
  • Black

A series of percentage grays that are useful for fine-tuning lighting color values and for other areas where subtle variations of grays are needed, and a palette 99 additional color definitions are available. See the distribution file ~include/colors.inc for more details.

Color macros

In POV-Ray all colors are handled in RGB color space with a component for the amount of red, green and blue light. However, not everybody thinks this is the most intuitive way to specify colors. For your convenience there are macros included in colors.inc that converts between a few different types of color spaces.

The supported color spaces:

  • RGB = < Red, Green, Blue, Filter, Transmit >
  • HSL = < Hue, Saturation, Lightness, Filter, Transmit >
  • HSV = < Hue, Saturation, Value, Filter, Transmit >
  • XYZ = < X, Y, Z, Filter, Transmit > (CIEXYZ; New in 3.7.1)
  • Lab = < Lightness L*, Chroma a*, Chroma b* > (more accurately L*a*b*, CIELAB; New in 3.7.1)

Note: The Hue parameter is given in degrees.

CHSL2RGB(Color): Converts a color given in HSL space to one in RGB space.

Parameters:

  • Color = HSL color to be converted.

CRGB2HSL(Color): Converts a color given in RGB space to one in HSL space.

Parameters:

  • Color = RGB color to be converted.

CHSV2RGB(Color): Converts a color given in HSV space to one in RGB space.

Parameters:

  • Color = HSV color to be converted.

CRGB2HSV(Color): Converts a color given in RGB space to one in HSV space.

Parameters:

  • Color = RGB color to be converted.

CXYZ2RGB(Color): Converts a color given in XYZ space to one in RGB space.

Parameters:

  • Color = XYZ color to be converted.

CRGB2XYZ(Color): Converts a color given in RGB space to one in XYZ space.

Parameters:

  • Color = RGB color to be converted.

CLab2RGB(Color,WhiteXYZ): Converts a color given in Lab space to one in RGB space.

Parameters:

  • Color = Lab color to be converted.
  • WhiteXYZ = XYZ color of the chosen L*a*b* variant's reference white point.

CRGB2Lab(Color,WhiteXYZ): Converts a color given in RGB space to one in Lab space.

Parameters:

  • Color = RGB color to be converted.
  • WhiteXYZ = XYZ color of the chosen L*a*b* variant's reference white point.

CLab2RGB_D65(Color): Converts a color given in Lab space (using D65 as reference white point) to one in RGB space.

Parameters:

  • Color = Lab color to be converted.

CRGB2Lab_D65(Color): Converts a color given in RGB space to one in Lab space (using D65 as reference white point).

Parameters:

  • Color = RGB color to be converted.