Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color input is inconsistent #45

Closed
illume opened this issue Aug 22, 2011 · 2 comments
Closed

Color input is inconsistent #45

illume opened this issue Aug 22, 2011 · 2 comments
Milestone

Comments

@illume
Copy link
Member

illume commented Aug 22, 2011

Originally reported by: René Dudfield (Bitbucket: illume, GitHub: 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.


@illume
Copy link
Member Author

illume commented Sep 6, 2011

Original comment by René Dudfield (Bitbucket: illume, GitHub: illume):


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.

@illume
Copy link
Member Author

illume commented Feb 14, 2012

Original comment by Lenard Lindstrom (Bitbucket: llindstrom, GitHub: llindstrom):


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

#!python
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

@illume illume added this to the 1.9.2 milestone Mar 26, 2017
This was referenced Mar 26, 2017
@illume illume modified the milestones: 1.9.2, 2.0 Feb 17, 2018
@illume illume modified the milestones: 2.0, 2.1 Jan 5, 2019
@illume illume closed this as completed in af6ca3b May 1, 2020
illume added a commit that referenced this issue May 1, 2020
…all-functions

Gh 45 fuzzy color matching in all functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant