Color arithmetic against tuples and ints has multiple issues

Issue #255 invalid
Anonymous created an issue

Console output is worth a thousand words:

>>> mycolor
(107, 142, 35, 255)
>>> mycolor+(25,25,25)
(110, 142, 35, 255)
>>>
>>> mycolor*(2,2,2)
(255, 0, 0, 0)
>>> mycolor*Color(2,2,2)
(214, 255, 70, 255)
>>>
>>> mycolor*2
(107, 0, 0, 0)
>>> mycolor//2
(107, 0, 0, 0)
>>> mycolor+2
(108, 142, 35, 255)
>>>
>>> pygame.ver
'1.9.2a0'

Comments (2)

  1. Lenard Lindstrom

    The Pygame Color type does not support arithmetic.

    >>> mycolor = pygame.Color(107, 142, 35, 255)
    >>> mycolor
    (107, 142, 35, 255)
    >>> mycolor+(25, 25, 25)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: unsupported operand type(s) for +: 'pygame.Color' and 'tuple'
    
  2. Log in to comment