Skip to content

Commit

Permalink
[Docs] Add project logo;
Browse files Browse the repository at this point in the history
Closes #5.
  • Loading branch information
MinchinWeb committed Jul 20, 2015
1 parent ceeae95 commit 5f52741
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 137 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changelog

.. currentmodule:: colourettu

- :support:`5` add project logo
- :feature:`8` allow addition of palettes, and palettes and colours
- :support:`-` manage changelog with `Releases <https://github.com/bitprophet/releases>`_
- :feature:`-` add :py:class:`palette` class
Expand Down
Binary file added docs/colourettu-logo-4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/colourettu-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'sphinx.ext.viewcode',
'sphinx.ext.napoleon', # requires Sphinx >=1.3
'releases',
'cloud_sptheme.ext.index_styling',
]

releases_github_path = 'minchinweb/colourettu'
Expand Down Expand Up @@ -145,7 +146,7 @@

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
html_logo = 'colourettu-logo.png'

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
Expand All @@ -168,7 +169,7 @@

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
Expand Down
33 changes: 26 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
Colourettu version |version| documentation
==========================================

Colourettu is a small collection of colour functions in Python, that can be
used to determine the (relative) luminosity of a colour and the contrast
between two colours.
.. image:: colourettu-logo-4x.png
:align: center

Colourettu is a small collection of colour functions in Python.
These can be used to determine the (relative) luminosity of a colour
and the contrast between two colours. There is also the palette class
for dealing with a 'list' of colours.

To install colourettu, the easiest way is to use `pip`::

Expand Down Expand Up @@ -32,10 +36,25 @@ Contents
Links
-----

- Code, on GitHub: http://www.github.com/minchinweb/colourettu/
- Report a Bug! https://github.com/minchinweb/colourettu/issues
- Documentation: http://minchin.ca/colourettu/
- Listing on PyPI: https://pypi.python.org/pypi/colourettu
- Code, on GitHub: http://www.github.com/minchinweb/colourettu/
- Report a Bug! https://github.com/minchinweb/colourettu/issues
- Documentation: http://minchin.ca/colourettu/
- Listing on PyPI: https://pypi.python.org/pypi/colourettu

.. image:: https://img.shields.io/pypi/v/colourettu.svg?style=flat
:target: https://pypi.python.org/pypi/colourettu/

.. image:: https://img.shields.io/pypi/dm/colourettu/badge.svg?style=flat
:target: https://pypi.python.org/pypi/colourettu/

.. image:: https://api.travis-ci.org/MinchinWeb/colourettu.svg
:target: http://travis-ci.org/MinchinWeb/colourettu

.. image:: https://coveralls.io/repos/MinchinWeb/colourettu/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/MinchinWeb/colourettu?branch=master

.. image:: https://img.shields.io/pypi/l/colourettu.svg?style=flat
:target: https://github.com/MinchinWeb/colourettu/blob/master/LICENSE

License
-------
Expand Down
2 changes: 1 addition & 1 deletion make_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
print('Commit current changes')
print('Update version number in __init__.py')
print('Test pass?')
print(' run `green -vv`')
print(' run `green test -vv`')
print('Update documenation')
print(' cd docs')
print(' make html')
Expand Down
138 changes: 11 additions & 127 deletions readme.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Colourettu is a small collection of colour functions in Python, that can be
used to determine the (relative) luminosity of a colour and the contrast
between two colours.
.. image:: https://raw.githubusercontent.com/MinchinWeb/colourettu/master/docs/colourettu-logo-4x.png
:align: center

Colourettu is a small collection of colour functions in Python. These can be used to determine the (relative) luminosity of a colour and the contrast between two colours. There is also the palette class for dealing with a ‘list’ of colours.

.. image:: https://img.shields.io/pypi/v/colourettu.svg?style=flat
:target: https://pypi.python.org/pypi/colourettu/
Expand Down Expand Up @@ -28,137 +29,20 @@ Installation

pip install colourettu

Note on Spelling
----------------
Documentation
-------------

I have used the Canadian/British spelling of *colour* through this and
the code.
Full documentation is at http://minchin.ca/colourettu/

Links
-----

- Code, on GitHub: http://www.github.com/minchinweb/colourettu/
- Report a Bug! https://github.com/minchinweb/colourettu/issues
- Documentation: http://minchin.ca/colourettu/
- Listing on PyPI: https://pypi.python.org/pypi/colourettu
- Code, on GitHub: http://www.github.com/minchinweb/colourettu/
- Report a Bug! https://github.com/minchinweb/colourettu/issues
- Documentation: http://minchin.ca/colourettu/
- Listing on PyPI: https://pypi.python.org/pypi/colourettu

License
-------

*Colourettu* is licensed under the MIT license.

Colour Class
------------

Colours are created by calling the ``colour`` class. Colour values can
be provided via 3 or 6 digit hex notation, or providing a list or a
tuple of the Red, Green, and Blue values (as integers).

.. code:: python
import colourettu
c1 = colourettu.colour() # defaults to #FFF
c2 = colourettu.colour("#eee") # equivalent to #EEEEEE
c3 = colourettu.colour("#456bda")
c4 = colourettu.colour([3, 56, 129])
c5 = colourettu.colour((63, 199, 233))
The value of each channel can be pulled out:

.. code:: python
>>> c4.red()
3
>>> c4.green()
56
>>> c4.blue()
129
You can also get the colour back as either a hex value, or a rgb tuple:

.. code:: python
>>> c2.hex()
'#EEEEEE'
>>> c2.rgb()
(238, 238, 238)
(Relative) Luminance
--------------------

Luminance is a measure of how 'bright' a colour is. Values are
normalized so that the Luminance of White is 1 and the Luminance of
Black is 0. That is to say:

.. code:: python
>>> colourettu.luminance("#FFF") # white
0.9999999999999999
>>> colourettu.luminance("#000") # black
0.0
``luminance`` can also be called on an already existing colour:

.. code:: python
>>> c3.luminance()
0.2641668488934239
>>> colourettu.luminance(c4)
0.08007571268096524
Contrast
--------

Contrast the difference in (perceived) brightness between colours.
Values vary between 1:1 (a given colour on itself) and 21:1 (white on
black).

To compute contrast, two colours are required.

.. code:: python
>>> colourettu.contrast("#FFF", "#FFF") # white on white
1.0
>>> colourettu.contrast(c1, "#000") # black on white
20.999999999999996
>>> colourettu.contrast(c4, c5)
4.363552233203198
``contrast`` can also be called on an already existing colour, but a
second colour needs to be provided:

.. code:: python
>>> c4.contrast(c5)
4.363552233203198
Use of Contrast
~~~~~~~~~~~~~~~

For Basic readability, the ANSI standard is a contrast of 3:1 between
the text and it's background. The W3C proposes this as a minimum
accessibility standard for regular text under 18pt and bold text under
14pt. This is referred to as the *A* standard. The W3C defines a higher
*AA* standard with a minimum contrast of 4.5:1. This is approximately
equivalent to 20/40 vision, and is common for those over 80. The W3C
define an even higher *AAA* standard with a 7:1 minimum contrast. This
would be equivalent to 20/80 vision. Generally, it is assumed that those
with vision beyond this would access the web with the use of assistive
technologies.

If needed, these constants are stored in the library.

.. code:: python
>>> colourettu.A_contrast
3.0
>>> colourettu.AA_contrast
4.5
>>> colourettu.AAA_contrast
7.0
I've also found mention that if the contrast is *too* great, this can
also cause readability problems when reading longer passages. This is
confirmed by personal experience, but I have been (yet) unable to find
any quantitative research to this effect.

0 comments on commit 5f52741

Please sign in to comment.