class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable

PHPExcelStyleColor

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Constants

COLOR_BLACK

COLOR_WHITE

COLOR_RED

COLOR_DARKRED

COLOR_BLUE

COLOR_DARKBLUE

COLOR_GREEN

COLOR_DARKGREEN

COLOR_YELLOW

COLOR_DARKYELLOW

Methods

__construct(string $pARGB = PHPExcel_Style_Color::COLOR_BLACK, boolean $isSupervisor = false, boolean $isConditional = false)

Create a new PHPExcelStyleColor

bindParent($parent, $parentPropertyName = null)

Bind parent. Only used for supervisor

boolean
getIsSupervisor()

Is this a supervisor or a cell style component?

getActiveSheet()

Get the currently active sheet. Only used for supervisor

string
getSelectedCells()

Get the currently active cell coordinate in currently active sheet.

string
getActiveCell()

Get the currently active cell coordinate in currently active sheet.

__clone()

Implement PHP __clone to create a deep clone, not just a shallow copy.

getSharedComponent()

Get the shared style component for the currently active cell in currently active sheet.

array
getStyleArray(array $array)

Build style array from subcomponents

applyFromArray(array $pStyles = null)

Apply styles from array

string
getARGB()

Get ARGB

setARGB(string $pValue = PHPExcel_Style_Color::COLOR_BLACK)

Set ARGB

string
getRGB()

Get RGB

setRGB(string $pValue = '000000')

Set RGB

static string
getRed(string $RGB, boolean $hex = true)

Get the red colour component of an RGB value

static string
getGreen(string $RGB, boolean $hex = true)

Get the green colour component of an RGB value

static string
getBlue(string $RGB, boolean $hex = true)

Get the blue colour component of an RGB value

static string
changeBrightness(string $hex, float $adjustPercentage)

Adjust the brightness of a color

indexedColor(int $pIndex, boolean $background = false)

Get indexed color

string
getHashCode()

Get hash code

Details

at line 84
__construct(string $pARGB = PHPExcel_Style_Color::COLOR_BLACK, boolean $isSupervisor = false, boolean $isConditional = false)

Create a new PHPExcelStyleColor

Parameters

string $pARGB ARGB value for the colour
boolean $isSupervisor Flag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are
boolean $isConditional Flag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are

at line 102
PHPExcel_Style_Supervisor bindParent($parent, $parentPropertyName = null)

Bind parent. Only used for supervisor

Parameters

$parent
$parentPropertyName

Return Value

PHPExcel_Style_Supervisor

boolean getIsSupervisor()

Is this a supervisor or a cell style component?

Return Value

boolean

PHPExcel_Worksheet getActiveSheet()

Get the currently active sheet. Only used for supervisor

Return Value

PHPExcel_Worksheet

string getSelectedCells()

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Return Value

string E.g. 'A1'

string getActiveCell()

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor

Return Value

string E.g. 'A1'

__clone()

Implement PHP __clone to create a deep clone, not just a shallow copy.

at line 115
PHPExcel_Style_Color getSharedComponent()

Get the shared style component for the currently active cell in currently active sheet.

Only used for style supervisor

Return Value

PHPExcel_Style_Color

at line 133
array getStyleArray(array $array)

Build style array from subcomponents

Parameters

array $array

Return Value

array

at line 161
PHPExcel_Style_Color applyFromArray(array $pStyles = null)

Apply styles from array

$objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') );

Parameters

array $pStyles Array containing style information

Return Value

PHPExcel_Style_Color

Exceptions

PHPExcel_Exception

at line 185
string getARGB()

Get ARGB

Return Value

string

at line 199
PHPExcel_Style_Color setARGB(string $pValue = PHPExcel_Style_Color::COLOR_BLACK)

Set ARGB

Parameters

string $pValue

Return Value

PHPExcel_Style_Color

at line 218
string getRGB()

Get RGB

Return Value

string

at line 232
PHPExcel_Style_Color setRGB(string $pValue = '000000')

Set RGB

Parameters

string $pValue RGB value

Return Value

PHPExcel_Style_Color

at line 273
static string getRed(string $RGB, boolean $hex = true)

Get the red colour component of an RGB value

Parameters

string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE
boolean $hex Flag indicating whether the component should be returned as a hex or a decimal value

Return Value

string The red colour component

at line 286
static string getGreen(string $RGB, boolean $hex = true)

Get the green colour component of an RGB value

Parameters

string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE
boolean $hex Flag indicating whether the component should be returned as a hex or a decimal value

Return Value

string The green colour component

at line 299
static string getBlue(string $RGB, boolean $hex = true)

Get the blue colour component of an RGB value

Parameters

string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE
boolean $hex Flag indicating whether the component should be returned as a hex or a decimal value

Return Value

string The blue colour component

at line 311
static string changeBrightness(string $hex, float $adjustPercentage)

Adjust the brightness of a color

Parameters

string $hex The colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE)
float $adjustPercentage The percentage by which to adjust the colour as a float from -1 to 1

Return Value

string The adjusted colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE)

at line 360
static PHPExcel_Style_Color indexedColor(int $pIndex, boolean $background = false)

Get indexed color

Parameters

int $pIndex Index entry point into the colour array
boolean $background Flag to indicate whether default background or foreground colour should be returned if the indexed colour doesn't exist

Return Value

PHPExcel_Style_Color

at line 442
string getHashCode()

Get hash code

Return Value

string Hash code