pygame is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

pygame / pygame http://pygame.org/

Clone this repository (size: 15.4 MB): HTTPS / SSH
hg clone https://bitbucket.org/pygame/pygame
hg clone ssh://hg@bitbucket.org/pygame/pygame

Issues

#45 Color input is inconsistent

Reported by illume

John, 2010-05-09 21:11:41 -0700

I'm using Pygame 1.9 with Python 3.1. The inconsistency with color input is slightly irritating. For example, Pygame.Color() accepts a variety of different input types. It accepts HTML style colors, tuples of integers, and hexadecimals. This is nice, but other parts of Pygame code don't use this. For example, Surface.fill() only accepts a tuple or a Color instance. I can't use the hexadecimal styles. I myself often make the mistake of using the wrong style of color and need to look up the documentation. I think consistency is extremely important for any software, especially a library for an elegant language like Python.

Status: open Responsible: illume Type: enhancement Priority: trivial
Milestone: 1.9.2 Component: other Version: 1.9

Attachments

No attachments added for this issue yet.

Comments and changes

  1. #1 illume

    written

    • Changed milestone from nothing to 1.9.2.
    • Changed type from bug to enhancement.
    • Changed status from new to open.

    Marking as an enhancement proposal.

    It would be nice to be able to do things like this:

    surf.fill('black')
    surf.fill('#FFEECCF0')
    

    I've often wanted this feature myself, and others have suggested it before.

    This needs some thought, and a lot of testing to see what side effects this could have. Also, we need to decide on scheduling if this is a much wanted feature or not, and how much work it would take to implement/test.

  2. #2 Lenard Lindstrom

    written

    This request would take significant refactoring, particularly in pygame.base and pygame.color and pygame.pixelarray. The simplest approach is to add '<name>' and '#<hex>' handling to _RGBAFromColorObj. Then anything in Pygame that accepts a color value would also take a string. It would also mean

    pixel_array[...] = 'black'
    

    would be allowed. I recall some objection to that, but if it is not a problem I can tackle this issue.

    Lenard

Add comment / attachment

Verification: Please write the text from the image in the box (letters only)

captcha

Is that you, Humanoid? Is this me?