pilas.colores

Package pilas :: Module colores |
[hide private]
[frames] | no frames]

# Source Code for Module pilas.colores

     1  import pilas
     2
     3 -class Color(object):
     4      "Representa un color en base a 4 componentes."
     5
     6 -    def __init__(self, r, g, b, a=255):
     7          self.r = r
     8          self.g = g
     9          self.b = b
    10          self.a = a
    11
    12 -    def obtener(self):
    13          return pilas.motor.Color(self.r, self.g, self.b, self.a)
    14
    15 -    def __str__(self):
    16          return "<Color (%d, %d, %d, %d)>" %(self.r, self.g, self.b, self.a)
    17
    18 -    def obtener_componentes(self):
    19          return (self.r, self.g, self.b, self.a)
    20
    21  # Colores principales.
    22  negro = Color(0, 0, 0)
    23  blanco = Color(255, 255, 255)
    24  rojo = Color(255, 0, 0)
    25  verde = Color(0, 255, 0)
    26  azul = Color(0, 0, 255)
    27  gris = Color(128, 128, 128)
    28
    29
    30  # Colores secundarios
    31  amarillo = Color(255, 255, 0)
    32  magenta = Color(255, 0, 255)
    33  cyan = Color(0, 255, 255)
    34  grisclaro = Color(192, 192, 192)
    35  grisoscuro = Color(100, 100, 100)
    36  verdeoscuro = Color(0, 128, 0)
    37  azuloscuro = Color(0, 0, 128)
    38  naranja = Color(255, 200, 0)
    39  rosa = Color(255, 175, 175)
    40  violeta = Color(128, 0, 255)
    41  marron = Color(153, 102, 0)
    42
    43  # Colores transparentes
    44  negro_transparente = Color(0, 0, 0, 160)
    45  blanco_transparente = Color(255, 255, 255, 160)
    46  rojo_transparente = Color(255, 0, 0, 160)
    47  verde_transparente = Color(0, 255, 0, 160)
    48  azul_transparente = Color(0, 0, 255, 160)
    49  gris_transparente = Color(128, 128, 128, 160)
    50