- Classes
- Namespaces
- Interfaces
- Index

Imagine API
Class

# Imagine\Image\Color

class Color

## Methods

| __construct(array|string|integer $color, integer $alpha) Constructs image color, e.g.: - new Color('fff') - will produce non-transparent white color - new Color('ffffff', 50) - will product 50% transparent white - new Color(array(255, 255, 255)) - another way of getting white - new Color(0x00FF00) - hexadecimal notation for green |
integer | getRed() Returns RED value of the color |
integer | getGreen() Returns GREEN value of the color |
integer | getBlue() Returns BLUE value of the color |
integer | getAlpha() Returns percentage of transparency of the color |
Color | dissolve(integer $alpha) Returns a copy of current color, incrementing the alpha channel by the given amount |
Color | lighten(integer $shade) Returns a copy of the current color, lightened by the specified number of shades |
Color | darken(integer $shade) Returns a copy of the current color, darkened by the specified number of shades |
string | __toString() Returns hex representation of the color |
Boolean | isOpaque() Checks if the current color is opaque |

## Details

###
at line 48
`public __construct(array|string|integer $color, integer $alpha)`

Constructs image color, e.g.: - new Color('fff') - will produce non-transparent white color - new Color('ffffff', 50) - will product 50% transparent white - new Color(array(255, 255, 255)) - another way of getting white - new Color(0x00FF00) - hexadecimal notation for green

#### Parameters

array|string|integer | $color |
integer | $alpha |

###
at line 59
`public integer getRed()`

Returns RED value of the color

#### Return Value

integer |

###
at line 69
`public integer getGreen()`

Returns GREEN value of the color

#### Return Value

integer |

###
at line 79
`public integer getBlue()`

Returns BLUE value of the color

#### Return Value

integer |

###
at line 89
`public integer getAlpha()`

Returns percentage of transparency of the color

#### Return Value

integer |

###
at line 102
`public Color dissolve(integer $alpha)`

Returns a copy of current color, incrementing the alpha channel by the given amount

#### Parameters

integer | $alpha |

#### Return Value

Color |

###
at line 115
`public Color lighten(integer $shade)`

Returns a copy of the current color, lightened by the specified number of shades

#### Parameters

integer | $shade |

#### Return Value

Color |

###
at line 135
`public Color darken(integer $shade)`

Returns a copy of the current color, darkened by the specified number of shades

#### Parameters

integer | $shade |

#### Return Value

Color |

###
at line 227
`public string __toString()`

Returns hex representation of the color

#### Return Value

string |

###
at line 237
`public Boolean isOpaque()`

Checks if the current color is opaque

#### Return Value

Boolean |