Coder Social home page Coder Social logo

ubernostrum / webcolors Goto Github PK

View Code? Open in Web Editor NEW
151.0 151.0 29.0 396 KB

A library for working with HTML/CSS color formats in Python.

Home Page: https://webcolors.readthedocs.io/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
colors css html python

webcolors's People

Contributors

adamchainz avatar ardell avatar tk0miya avatar ubernostrum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

webcolors's Issues

.dist-info directory not found

This seems to have been introduced when upgrading from 1.7.0 to 1.8.0.

Installing via pip is giving the following error:

AssertionError: webcolors .dist-info direction not found

I've locked the version on my end to 1.7.0, so it works.

Here's details about my environment if that helps:

pip: 9.0.1
python: 3.5.1

Add py.typed marker

While the project seems to use type annotations internally, type checkers will ignore them because the py.typed marker file is missing. Note that adding the file will not be enough, since you will also need to explicitly add py.typed to the package_data so the py.typed marker is still there after installation.

Feature Request: generic parse function

I read through the documentation but couldn't find any function which simply allows throwing in any css color attribute and getting back RGB information.

styles = {'color': 'hotpink', 'background-color': '#C0FFEE'}

webcolors.parse(styles['color'])
webcolors.parse(styles['background-color'])

Feature request: get color group instead of color name

Hi,

I've recently used this module to get the name of an RGB color, but was only interested in getting generic names (like the group names from here). I needed to write a dictionary for converting from color name to color group.

What about extending the functionality of get_colour_name by adding a group flag? If needed, I could totally help with that.

Best,
Cosmina

Webcolors install fails due to syntax error

I have a Raspberry Pi with Raspbian and Python 3.2.3. When I attempt to install Webcolors with pip, or manually download the tar.gz and run the install script, I get the following error:

running install
running build
running build_py
running install_lib
creating /usr/local/lib/python3.2
creating /usr/local/lib/python3.2/dist-packages
copying build/lib/webcolors.py -> /usr/local/lib/python3.2/dist-packages
byte-compiling /usr/local/lib/python3.2/dist-packages/webcolors.py to webcolors.cpython-32.pyc
File "/usr/local/lib/python3.2/dist-packages/webcolors.py", line 41
SUPPORTED_SPECIFICATIONS = (u'html4', u'css2', u'css21', u'css3')
^
SyntaxError: invalid syntax

running install_egg_info
Writing /usr/local/lib/python3.2/dist-packages/webcolors-1.5.egg-info

Any ideas?

Feature request: Function to convert to floats from 0 to 1

Hi there! And thanks for this useful library!

I'm using this with pycollada, which wants RGB values as arrays of three floats from 0.0 to 1.0.

Would you be interested in a pull request to a function for exposing color values as rgb floats?

GPG signatures for source validation

As we all know, today more than ever before, it is crucial to be able to trust our computing environments. One of the main difficulties that package maintainers of GNU/Linux distributions face, is the difficulty to verify the authenticity and the integrity of the source code. With GPG signatures it is possible for packagers to verify source code releases quickly and easily.

Overview of the required tasks:

GPGit

GPGit is meant to bring GPG to the masses. It is not only a Python script that automates the process of creating new signed Git releases with GPG, but also a quick-start-guide for learning how to use GPG. GPGit integrates perfectly with the Github Release API for uploading.

The security status of GNU/Linux projects will be tracked in the Linux Security Database. If you have any further questions, do not hesitate to contact me personally. Thanks for your help in making GNU/Linux projects more secure by using GPG signatures.

Thanks in advance.

Typing annotations are unusable for external code

While webcolors has typing annotations in the code (which is amazing!), unfortunately those annotation can't be used by mypy to actually check the code against those annotations.

$ cat test.py
import webcolors

$ mypy test.py
test.py:1: error: Skipping analyzing 'webcolors': found module but no type hints or library stubs
test.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)                                                                                                                                                                                                 

$ mypy --version
mypy 0.812                                                                                                                                                                                                                                      

$ python --version
Python 3.9.2                                                                                             

The reason for that is webcolors get installed as site-packages/webcolors.py, but for mypy to be able to use the typing annotations in the code, it should be installed as site-packages/webcolors/__init__.py, with empty site-packages/webcolors/py.typed file present.

See https://mypy.readthedocs.io/en/stable/installed_packages.html for details.

Conversion for RGBA

Love the library and use it regularly for my projects!
It would be cool if there was the conversion to and from RGBA.
A in RGBA stands for Alpha and basically represents the opacity for each pixel (in %).
Perhaps it's possible to use the existing methods to convert the last 2 characters in 8 character HEX string into Alpha %.

Color names

I would like to know how many colors does webcolors provide?

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.