diff options
-rw-r--r-- | README.rst | 58 | ||||
-rw-r--r-- | docs/conf.py | 2 | ||||
-rwxr-xr-x | thcolor/__init__.py | 2 |
3 files changed, 56 insertions, 6 deletions
@@ -1,7 +1,57 @@ -thcolor -- switch between color formats -======================================= +thcolor -- the touhey color management module +============================================= -This module defines the ``Color`` primitive. For more information, read the -documentation accessible on `the official website`_. +This module is a color management module made by `Thomas Touhey`_ (``th`` +is for ``touhey``) for the `textoutpc`_ project, a BBCode to HTML translation +module. It provides the following features: +- color management and conversions between formats (RGB, HSL, HWB, NCol, …). +- text-to-color using close-to-CSS format. + +For more information, consult `the official website`_. + +Examples +-------- + +Converting an RGB color to HSL: + +.. code-block:: python + + from thcolor import Color + + color = Color(Color.Type.RGB, 55, 23, 224) + print(color.hsl()) + +Converting a HSL color to RGB with an alpha value: + +.. code-block:: python + + from thcolor import Color, Angle + + alpha = 0.75 + color = Color(Color.Type.HSL, Angle(Angle.Type.DEG, 180), 0.5, 1.0, alpha) + print(color.rgba()) + +Converting a textual representation to the RGBA color components: + +.. code-block:: python + + from thcolor import Color + + color = Color.from_text("darker(10%, hsl(0, 1, 50.0%))") + print(color.rgba()) + +Getting the CSS color representations (with compatibility for earlier CSS +versions) from a textual representation: + +.. code-block:: python + + from thcolor import Color + + color = Color.from_text("gray(red( #123456 )/0.2/)") + for repres in color.css(): + print(f"color: {repres}") + +.. _Thomas Touhey: https://thomas.touhey.fr/ +.. _textoutpc: https://textout.touhey.pro/ .. _the official website: https://thcolor.touhey.pro/ diff --git a/docs/conf.py b/docs/conf.py index 2a38ddf..ee5a7c5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ copyright = '2019, Thomas Touhey' author = 'Thomas Touhey' # The full version, including alpha/beta/rc tags -release = '0.2.2' +release = '0.3' # -- General configuration --------------------------------------------------- diff --git a/thcolor/__init__.py b/thcolor/__init__.py index 6d07264..545bbb4 100755 --- a/thcolor/__init__.py +++ b/thcolor/__init__.py @@ -23,6 +23,6 @@ __all__ = ["version", "Color", "Reference", "Angle", "CSS1Reference", "CSS2Reference", "CSS3Reference", "CSS4Reference", "DefaultReference"] -version = "0.2.2" +version = "0.3" # End of file. |