Routines (alphabetical) > Routines: H > HSV

# HSV

The HSV procedure creates a color table based on the HSV (Hue and Saturation Value) color system.

Using the input parameters, a spiral through the single-ended HSV cone is traced. The color representation of pixel values is linearly interpolated from beginning and ending values of hue, saturation, and value. Points along the cone are converted from HSV to RGB. The current colortable (and the COLORS common block) contains the new colortable on exit.

This routine is written in the IDL language. Its source code can be found in the file `hsv.pro` in the `lib` subdirectory of the IDL distribution.

## Example

Copy and paste the following code at the IDL command line to see an example of using the HSV procedure.

; Locate the moon_landing.png file, then read it in.

place = FILEPATH('moon_landing.png', SUBDIR=['examples', 'data'])

READ_PNG, place, picture

; Generate some values to use in the argument in

; creating the new colortable.

loop = FIX(500*RANDOMU(seed))

v1= FIX(100*RANDOMU(seed))

v2= FIX(100*RANDOMU(seed))

s1= FIX(100*RANDOMU(seed))

s2= FIX(100*RANDOMU(seed))

degree= FIX(360*RANDOMU(seed))

; Create a new colortable 'col' based on the randomly-generated

; values, above.

HSV, v1, v2, s1, s2, degree, loop, col

see = IMAGE(picture, RGB_TABLE=col)

; Run this example many times to see the different

; color tables you can get.

## Syntax

HSV, Vlo, Vhi, Satlo, Sathi, Hue, Loops [, Colr]

## Arguments

### Vlo

Starting value, from 0 to 100%.

### Vhi

Ending value, from 0 to 100%.

### Satlo

Starting saturation, from 0 to 100%.

### Sathi

Ending saturation, from 0 to 100%.

### Hue

Starting Hue, from 0 to 360 degrees. Red = 0 degs, green = 120, blue = 240.

### Loops

The number of loops through the color spiral. This parameter does not have to be an integer. A negative value causes the loops to traverse the spiral in the opposite direction.

### Colr

An optional (256,3) integer array in which the new R, G, and B values are returned. Red = Colr[*,0], green = Colr[*,1], blue = Colr[*,2].

## Keywords

None.

## Version History

Original | Introduced

## See Also

COLOR_QUAN, HLS, PSEUDO