Package omero :: Package gateway :: Class ColorHolder
[hide private]
[frames] | no frames]

Class ColorHolder

source code


Stores color internally as (R,G,B,A) and allows setting and getting in multiple formats

Instance Methods [hide private]
 
__init__(self, colorname=None)
If colorname is 'red', 'green' or 'blue', set color accordingly - Otherwise black
source code
int
getRed(self)
Gets the Red component
source code
 
setRed(self, val)
Set red, as int 0..255
source code
int
getGreen(self)
Gets the Green component
source code
 
setGreen(self, val)
Set green, as int 0..255
source code
int
getBlue(self)
Gets the Blue component
source code
 
setBlue(self, val)
Set Blue, as int 0..255
source code
int
getAlpha(self)
Gets the Alpha component
source code
 
setAlpha(self, val)
Set alpha, as int 0..255.
source code
String
getHtml(self)
Gets the html usable color.
source code
String
getCss(self)
Gets the css string: rgba(r,g,b,a)
source code
tuple of ints
getRGB(self)
Gets the (r,g,b) as a tuple.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
ColorHolder
fromRGBA(klass, r, g, b, a)
Class method for creating a ColorHolder from r,g,b,a values
source code
Class Variables [hide private]
  _color = {'red': 0, 'green': 0, 'blue': 0, 'alpha': 255}
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, colorname=None)
(Constructor)

source code 

If colorname is 'red', 'green' or 'blue', set color accordingly - Otherwise black

Parameters:
  • colorname (String) - 'red', 'green' or 'blue'
Overrides: object.__init__

fromRGBA(klass, r, g, b, a)
Class Method

source code 

Class method for creating a ColorHolder from r,g,b,a values

Parameters:
  • r (int) - red 0 - 255
  • g (int) - green 0 - 255
  • b (int) - blue 0 - 255
  • a (int) - alpha 0 - 255
Returns: ColorHolder
new Color object

getRed(self)

source code 

Gets the Red component

Returns: int
red

setRed(self, val)

source code 

Set red, as int 0..255

Parameters:
  • val (Int) - value of Red.

getGreen(self)

source code 

Gets the Green component

Returns: int
green

setGreen(self, val)

source code 

Set green, as int 0..255

Parameters:
  • val (Int) - value of Green.

getBlue(self)

source code 

Gets the Blue component

Returns: int
blue

setBlue(self, val)

source code 

Set Blue, as int 0..255

Parameters:
  • val (Int) - value of Blue.

getAlpha(self)

source code 

Gets the Alpha component

Returns: int
alpha

setAlpha(self, val)

source code 

Set alpha, as int 0..255.

Parameters:
  • val - value of alpha.

getHtml(self)

source code 

Gets the html usable color. Dumps the alpha information. E.g. 'FF0000'

Returns: String
html color

getCss(self)

source code 

Gets the css string: rgba(r,g,b,a)

Returns: String
css color

getRGB(self)

source code 

Gets the (r,g,b) as a tuple.

Returns: tuple of ints
Tuple of (r,g,b) values