Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiommendes committed Sep 9, 2016
0 parents commit 53f09cd
Show file tree
Hide file tree
Showing 21 changed files with 1,633 additions and 0 deletions.
30 changes: 30 additions & 0 deletions INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
=========================
Installation instructions
=========================

colortools can be installed using pip::

$ python -m pip install colortools

This command will fetch the archive and its dependencies from the internet and
install them. You may need to pick either ``python2``` or ``python3`` in
order to select the correct python version.

If you've downloaded the tarball, unpack it, and execute::

$ python setup.py install

In either case, it is possible to perform local user installs by appending the
``--user`` option.


Troubleshoot
------------

Windows users may find that these command will only works if typed from Python's
installation directory.

Some Linux distributions (e.g. Ubuntu) install Python without installing pip.
Please install it before. If you don't have root privileges, download the
get-pip.py script at https://bootstrap.pypa.io/get-pip.py and execute it as
``python get-pip.py --user``.
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
colortools.
Copyright (C) Fábio Macêdo Mendes

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include INSTALL.rst
include README.rst
include LICENSE
include VERSION
include requirements.txt
include tasks.py
48 changes: 48 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
The :mod:`colortools` defines a :cls:`Color` object that can be used to
represent and manipulate colors in various contexts. It was created with the
:mod:`FGAme` game engine, but it can also be used in other contexts such as
arts and web applications.

Colors can be initialized from the RGB/RGBA components, in which each component
is in the 0-255 range.

>>> w1 = Color(255, 255, 255)
>>> w2 = Color(255, 255, 255, 255)
>>> w1 == w2
True

The constructor also accepts color names, hex strings or hex numbers.

>>> Color('white') == Color('#FFF') == Color(0xffffff) == Color(255, 255, 255)
True

All names in CSS3.0 are accepted (see the complete list `here<http://www.w3.org/TR/css3-color/#svg-color>`).
It is worth noting that although the *G* in RGB stands for green, the color
with a full green value is called *lime*, while "green" is **#008000** rather than
**#00FF00**.

Usage and API
-------------

Color objects are immutable and behave like a tuple of 4 values.

>>> list(Color('green'))
[0, 80, 0, 255]

It also exposes several different representations of a color using the
appropriate attribute.

>>> blue = Color('blue')
>>> blue.rbg
(255, 0, 0)

>>> blue.rgbf
(1.0, 0.0, 0.0)

>>> blue.rgbu
16711680

Color objects also implement a few useful transformations

>>> blue.darken(0.1) # darken by 10%
Color(229, 0, 0)
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.1
54 changes: 54 additions & 0 deletions boilerplate.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[options]
project = colortools
author = Fábio Macêdo Mendes
email = [email protected]
version = 0.1.0
license = gpl
pyname = colortools

[file hashes]
VERSION = 5dGLTiwdwZdXde44WrQchQ==

.gitignore = iu2Zn1vki51Un7bnWFivjQ==

README.rst = uPdLHOwxE8pcjE53T+O1iQ==

INSTALL.rst = k/F9ZlbJ3CYk9U2SVpTXNw==

LICENSE = HlS8/vbcwNyIFgy6FnicyQ==

tasks.py = 6GOUg08jHdzGhTHggdHrsA==

setup.py = jO1VBZHTTbhmUaSvZLAF7Q==

MANIFEST.in = BR29dThJGj3LpFi457HDsw==

requirements.txt = 9/H6jW0guTB5y4aYQ+29FA==

requirements-dev.txt = IrFEvOtt6TH8c3X1z/Qgrg==

src/colortools/__init__.py = 1zLEKfdEAfCqC71HMe3ifA==

src/colortools/__meta__.py = ITV3jN2HNctrB2gBnc7WNA==

src/colortools/__main__.py = lmKoqR1olD5mZ7TNIYbAug==

src/colortools/tests/test_colortools.py = vb8s3uOxr/85JLBtXNlJ6Q==

docs/conf.py = /k5SqU8PfyrF6IJZu6cPfg==

docs/index.rst = BcUr6MxiaEfZvfinE/Qx7g==

docs/install.rst = uEvES6MgO5srBNLXAVqL/Q==

docs/license.rst = T7JCt0IDBksEuohsOM3rxQ==

docs/apidoc.rst = id1zCZJLYOZFBT5/kbmjBw==

docs/warning.rst = O2SiWXTOqJBpkFGu1aW+VA==

docs/make.bat = AyOyYMZZh/t1xRThRsgGOA==

docs/Makefile = sHJpgsLZvsiYQotqGNXIhw==


216 changes: 216 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"

.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*

.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."

.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."

.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/colortools.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/colortools.qhc"

.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."

.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/colortools"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/colortools"
@echo "# devhelp"

.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."

.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."

.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."

.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."

.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."

.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."

.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."

.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
8 changes: 8 additions & 0 deletions docs/apidoc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=============
API Reference
=============

API documentation for the colortools module.

.. automodule:: colortools
:members:
Loading

0 comments on commit 53f09cd

Please sign in to comment.