Difference between revisions of "Reference:Colors.inc"

From POV-Wiki
Jump to navigation Jump to search
m (1 revision: Reference Migration Initial Load)
m (removed obsolete passage)
Line 62: Line 62:
 
<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>
 
 
{{#indexentry:include files, Convert_Color}}
 
<p><code>Convert_Color(SourceType, DestType, Color)</code>: Converts a color from one color space to another. Color spaces available are: <code>RGB</code>, <code>HSL</code>, and <code>HSV</code>:</p>
 
<p>Parameters:</p>
 
<ul>
 
<li><code>SourceType</code> = Color space of input color.</li>
 
<li><code>DestType</code> = Desired output color space.</li>
 
<li><code>Color</code> = Color to be converted, in SourceType color space.</li>
 
 
</ul>
 
</ul>

Revision as of 22:16, 25 February 2014

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 three supported color spaces:

  • RGB = < Red, Green, Blue, Filter, Transmit >
  • HSL = < Hue, Saturation, Lightness, Filter, Transmit >
  • HSV = < Hue, Saturation, Value, Filter, Transmit >

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.