{"id":18615714,"url":"https://github.com/jshwi/object-colors","last_synced_at":"2025-11-03T04:30:35.487Z","repository":{"id":37102715,"uuid":"209554496","full_name":"jshwi/object-colors","owner":"jshwi","description":"Object-oriented library for stylizing terminal output","archived":false,"fork":false,"pushed_at":"2024-04-12T11:59:16.000Z","size":1118,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-12T18:41:59.284Z","etag":null,"topics":["ansi","color","oop","terminal","tty"],"latest_commit_sha":null,"homepage":"https://object-colors.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jshwi.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-09-19T12:58:07.000Z","updated_at":"2024-04-15T07:33:27.839Z","dependencies_parsed_at":"2023-12-25T20:09:52.219Z","dependency_job_id":"d1d173ba-5f7c-47e9-97fd-332b531fc447","html_url":"https://github.com/jshwi/object-colors","commit_stats":{"total_commits":218,"total_committers":3,"mean_commits":72.66666666666667,"dds":"0.16055045871559637","last_synced_commit":"83b303237e9801e72b020f3a55632321568a7c66"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshwi%2Fobject-colors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshwi%2Fobject-colors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshwi%2Fobject-colors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshwi%2Fobject-colors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jshwi","download_url":"https://codeload.github.com/jshwi/object-colors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239406498,"owners_count":19633025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi","color","oop","terminal","tty"],"created_at":"2024-11-07T03:31:31.026Z","updated_at":"2025-11-03T04:30:35.444Z","avatar_url":"https://github.com/jshwi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Status: Archived\n==================\nThis repository has been archived and is no longer maintained\n\nobject-colors\n=============\n|Inactive| |License| |PyPI| |CI| |CodeQL| |pre-commit.ci status| |codecov.io| |readthedocs.org| |python3.8| |Black| |isort| |docformatter| |pylint| |Security Status| |Known Vulnerabilities| |borgini|\n\n.. |Inactive| image:: https://img.shields.io/badge/status-inactive-red.svg\n    :target: https://img.shields.io/badge/status-inactive-red.svg\n    :alt: Status Inactive\n.. |License| image:: https://img.shields.io/badge/License-MIT-yellow.svg\n    :target: https://opensource.org/licenses/MIT\n    :alt: License\n.. |PyPI| image:: https://img.shields.io/pypi/v/object-colors\n    :target: https://pypi.org/project/object-colors/\n    :alt: PyPI\n.. |CI| image:: https://github.com/jshwi/object-colors/actions/workflows/build.yaml/badge.svg\n    :target: https://github.com/jshwi/object-colors/actions/workflows/build.yaml\n    :alt: CI\n.. |CodeQL| image:: https://github.com/jshwi/object-colors/actions/workflows/codeql-analysis.yml/badge.svg\n    :target: https://github.com/jshwi/object-colors/actions/workflows/codeql-analysis.yml\n    :alt: CodeQL\n.. |pre-commit.ci status| image:: https://results.pre-commit.ci/badge/github/jshwi/object-colors/master.svg\n    :target: https://results.pre-commit.ci/latest/github/jshwi/object-colors/master\n    :alt: pre-commit.ci status\n.. |codecov.io| image:: https://codecov.io/gh/jshwi/object-colors/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/jshwi/object-colors\n    :alt: codecov.io\n.. |readthedocs.org| image:: https://readthedocs.org/projects/object-colors/badge/?version=latest\n    :target: https://object-colors.readthedocs.io/en/latest/?badge=latest\n    :alt: readthedocs.org\n.. |python3.8| image:: https://img.shields.io/badge/python-3.8-blue.svg\n    :target: https://www.python.org/downloads/release/python-380\n    :alt: python3.8\n.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Black\n.. |isort| image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat\u0026labelColor=ef8336\n    :target: https://pycqa.github.io/isort/\n    :alt: isort\n.. |docformatter| image:: https://img.shields.io/badge/%20formatter-docformatter-fedcba.svg\n    :target: https://github.com/PyCQA/docformatter\n    :alt: docformatter\n.. |pylint| image:: https://img.shields.io/badge/linting-pylint-yellowgreen\n    :target: https://github.com/PyCQA/pylint\n    :alt: pylint\n.. |Security Status| image:: https://img.shields.io/badge/security-bandit-yellow.svg\n    :target: https://github.com/PyCQA/bandit\n    :alt: Security Status\n.. |Known Vulnerabilities| image:: https://snyk.io/test/github/jshwi/object-colors/badge.svg\n    :target: https://snyk.io/test/github/jshwi/object-colors/badge.svg\n    :alt: Known Vulnerabilities\n.. |object-colors| image:: https://snyk.io/advisor/python/docsig/badge.svg\n    :target: https://snyk.io/advisor/python/object-colors\n    :alt: object-colors\n\nObject-oriented library for stylizing terminal output\n-----------------------------------------------------\n\nInstallation\n------------\n\n.. code-block:: console\n\n    $ pip install object-colors\n..\n\nUsage\n-----\n\nImport the ``Color`` object from ``object_colors``\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from object_colors import Color\n\nArgs can be provided as strings or as indices corresponding to their index in an ANSI escape sequence\n\n.. code-block:: python\n\n    \u003e\u003e\u003e Color(effect=\"bold\", fore=\"red\", back=\"green\")\n    Color(effect=1, fore=1, back=2, objects())\n\nThe following would yield the same result\n\n.. code-block:: python\n\n    \u003e\u003e\u003e Color(effect=1, fore=1, back=2)\n    Color(effect=1, fore=1, back=2, objects())\n\nThe above options are part of the below mapping\n\n.. code-block:: python\n\n    \u003e\u003e\u003e for i, c in enumerate(Color.colors):\n    ...     print(i, c)\n    0 black\n    1 red\n    2 green\n    3 yellow\n    4 blue\n    5 magenta\n    6 cyan\n    7 white\n\n.. code-block:: python\n\n    \u003e\u003e\u003e for i, e in enumerate(Color.effects):\n    ...     print(i, e)\n    0 none\n    1 bold\n    2 dim\n    3 italic\n    4 underline\n    5 blink\n    6 blinking\n    7 negative\n    8 empty\n    9 strikethrough\n\n\nTo configure the current object either ``effect``, ``fore``, or ``back`` can be provided\n\nThey must be an ``int``, ``str``, or ``None`` type\n\n.. code-block:: python\n\n    \u003e\u003e\u003e c = Color()\n    \u003e\u003e\u003e c.set(effect=\"bold\", fore=\"red\", back=\"red\")\n    \u003e\u003e\u003e c\n    Color(effect=1, fore=1, back=1, objects())\n\nCreate new objects with by providing a ``dict`` object with any keyword argument\n\nUse ``set`` to set multiple parameters\n\n.. code-block:: python\n\n    \u003e\u003e\u003e c = Color()\n    \u003e\u003e\u003e c.set(bold_green=dict(effect=\"bold\", fore=\"green\"))\n    \u003e\u003e\u003e c\n    Color(effect=None, fore=None, back=None, objects(bold_green))\n\nReturn ``str`` or ``tuple`` using ``get``\n\n.. code-block:: python\n\n    \u003e\u003e\u003e c = Color()\n    \u003e\u003e\u003e c.set(red=dict(fore=\"red\"))\n    \u003e\u003e\u003e c.set(yellow=dict(fore=\"yellow\"))\n    \u003e\u003e\u003e f\"{c.red.get('*')} {c.yellow.get('Warning')}\"\n    '\\x1b[31m*\\x1b[0;0m \\x1b[33mWarning\\x1b[0;0m'\n\n.. code-block:: python\n\n    \u003e\u003e\u003e c = Color()\n    \u003e\u003e\u003e c.set(red=dict(fore=\"red\"))\n    \u003e\u003e\u003e xyz = c.red.get(\"x\", \"y\", \"z\")\n    \u003e\u003e\u003e xyz\n    ('\\x1b[31mx\\x1b[0;0m', '\\x1b[31my\\x1b[0;0m', '\\x1b[31mz\\x1b[0;0m')\n    \u003e\u003e\u003e x, y, z = xyz\n    \u003e\u003e\u003e f\"{x} {y} {z}\"\n    '\\x1b[31mx\\x1b[0;0m \\x1b[31my\\x1b[0;0m \\x1b[31mz\\x1b[0;0m'\n\nPrint the result using ``print``\n\n.. code-block:: python\n\n    \u003e\u003e\u003e c = Color(effect=\"bold\", fore=\"cyan\")\n    \u003e\u003e\u003e # doctest strips ansi codes from print\n    \u003e\u003e\u003e c.print(\"bold cyan\")  # '\\x1b[1;36mbold cyan\\x1b[0;0m'\n    bold cyan\n\nLoad all ``effect``, ``fore``, or ``back`` elements using ``populate()``\n\n.. code-block:: python\n\n    \u003e\u003e\u003e c = Color()\n    \u003e\u003e\u003e c.populate(\"fore\")\n    \u003e\u003e\u003e c\n    Color(effect=None, fore=None, back=None, objects(black, red, green, yellow, blue, magenta, cyan, white))\n\n.. code-block:: python\n\n    \u003e\u003e\u003e c = Color()\n    \u003e\u003e\u003e c.set(red=dict(fore=\"red\"))\n    \u003e\u003e\u003e c.red.populate(\"effect\")\n    \u003e\u003e\u003e c.red\n    Color(effect=None, fore=1, back=None, objects(none, bold, dim, italic, underline, blink, blinking, negative, empty, strikethrough))\n    \u003e\u003e\u003e # doctest strips ansi codes from print\n    \u003e\u003e\u003e c.red.strikethrough.print(\"strikethrough red\")  # '\\x1b[9;31mstrikethrough red\\x1b[0;0m'\n    strikethrough red\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjshwi%2Fobject-colors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjshwi%2Fobject-colors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjshwi%2Fobject-colors/lists"}