<div class="meta" robots="noindex">

</div>

Method

# CMY

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `Color.CMY<color.cmy>` as a replacement.

</div>

## Description

Returns a `Color</api/data_types/color>` based on the <span class="title-ref">CMY</span> (cyan, magenta, yellow) color model and the specified level of transparency. Use the new form of the `Picture</api/graphics/picture>` constructor to create pictures that support the alpha channel or convert existing pictures to the new format using the code described in `HasAlphaChannel<picture.hasalphachannel>`.

## Usage

*result* = **CMY**(*cyan*, *magenta*, *yellow* \[, *alpha* = 0\])

| Part    | Type                               | Description                                                                                                                                       |
|---------|------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| result  | `Color</api/data_types/color>`     | An object that represents the color based on the *cyan*, *magenta*, and *yellow* values.                                                          |
| cyan    | `Double</api/data_types/double>`   | The value of Cyan in the color (0-1).                                                                                                             |
| magenta | `Double</api/data_types/double>`   | The value of Magenta in the color (0-1).                                                                                                          |
| yellow  | `Double</api/data_types/double>`   | The value of Yellow in the color (0-1).                                                                                                           |
| alpha   | `Integer</api/data_types/integer>` | The value of transparency in the color (0-255). Zero is completely opaque and 255 is transparent. If omitted, the default is 0 (no transparency). |

## Notes

The <span class="title-ref">CMY</span> function returns a `Color</api/data_types/color>` based on the amounts of Cyan, Magenta, Yellow, and transparency passed. The color amounts are represented by `doubles</api/data_types/double>` between 0 and 1 and are stored internally as three bytes. The level of transparency is an optional `Integer</api/data_types/integer>` from 0-255. If omitted, it defaults to completely opaque. You can also use either the `Color.RGB<color.rgb>` or `Color.HSV<color.hsv>` models to assign a color and you can also specify a color with the RGB model using the `&c</api/language/literals/c>` literal. All alternatives support the optional transparency parameter.

## Sample code

This code uses the <span class="title-ref">CMY</span> function to assign a `Color</api/data_types/color>`. It is in the Paint event of a `Canvas</api/deprecated/canvas>` or a `Window</api/deprecated/window>`.

``` xojo
Rectangle1.FillColor = CMY(0.35, 0.9, 0.6)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The following code draws a color patch in a `Canvas</api/deprecated/canvas>` with 75% transparency. With the <span class="title-ref">CMY</span> function, the range is from 0 to 255. Zero is completely opaque and 255 is completely transparent. The code is in the `Paint<canvas.paint>` event.

``` xojo
g.ForeColor = CMY(0.0, 1.0, 1.0, 255 * 0.75) ' transparency = 75%

g.FillRect(0, 70, 200, 50)
g.ForeColor = CMY(0.0, 0.0, 0.0)
g.DrawString("Translucent = 30%", 210, 80)
```

## Compatibility

All project types on all supported operating systems.

## See also

`Color</api/data_types/color>` data type; `Color.HSV<color.hsv>`, `Color.RGB<color.rgb>`, `Color.SelectedFromDialog<color.selectedfromdialog>` functions; `&c</api/language/literals/c>` literal.
