Check for Alpha Channel

Description

Helper method to check if the current color object has an alpha channel or not.

Usage

HSV.hasalpha()

Return

bool: True if alpha values are present, False if not.

Examples

from colorspace import sRGB
x1 = sRGB(R = 0.5, G = 0.1, B = 0.3)
x1
sRGB color object (1 colors)
            R       G       B
  1:     0.50    0.10    0.30
x2 = sRGB(R = 0.5, G = 0.1, B = 0.3, alpha = 0.5)
x2
sRGB color object (1 colors)
            R       G       B   alpha
  1:     0.50    0.10    0.30    0.50
# Checking both color objects for alpha channel
[x1.hasalpha(), x2.hasalpha()]
[False, True]