{"id":21150800,"url":"https://github.com/cedargrovestudios/circuitpython_rgb_spectrumtools","last_synced_at":"2026-04-28T17:03:02.197Z","repository":{"id":62293327,"uuid":"559338726","full_name":"CedarGroveStudios/CircuitPython_RGB_SpectrumTools","owner":"CedarGroveStudios","description":"A collection of CircuitPython methods and classes for converting a normalized spectral index to RGB color values.","archived":false,"fork":false,"pushed_at":"2023-11-30T17:31:37.000Z","size":1865,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T16:55:10.467Z","etag":null,"topics":["circuitpython","circuitpython-community-bundle","color-blending"],"latest_commit_sha":null,"homepage":"","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/CedarGroveStudios.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-29T19:59:19.000Z","updated_at":"2022-11-07T19:18:54.000Z","dependencies_parsed_at":"2023-01-21T20:02:53.205Z","dependency_job_id":"ea05b74f-d724-4d7f-86ab-05b169440c2e","html_url":"https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/CedarGroveStudios/CircuitPython_RGB_SpectrumTools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CedarGroveStudios%2FCircuitPython_RGB_SpectrumTools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CedarGroveStudios%2FCircuitPython_RGB_SpectrumTools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CedarGroveStudios%2FCircuitPython_RGB_SpectrumTools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CedarGroveStudios%2FCircuitPython_RGB_SpectrumTools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CedarGroveStudios","download_url":"https://codeload.github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CedarGroveStudios%2FCircuitPython_RGB_SpectrumTools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32390067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["circuitpython","circuitpython-community-bundle","color-blending"],"created_at":"2024-11-20T10:08:24.307Z","updated_at":"2026-04-28T17:03:02.159Z","avatar_url":"https://github.com/CedarGroveStudios.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Introduction\n============\n\n\n\n\n.. image:: https://img.shields.io/discord/327254708534116352.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n\n.. image:: https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools/workflows/Build%20CI/badge.svg\n    :target: https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools/actions\n    :alt: Build Status\n\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\nA collection of methods and classes for converting a normalized index to RGB\ncolor values. Included in the collection are spectral conversion methods for\ngrayscale, iron temperature color, stoplight (green-yellow-red), and visible\nlight as well as classes for n-color blended light.\n\n.. image:: https://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools/blob/main/media/color_spectrum_test.jpeg\n\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython \u003chttps://github.com/adafruit/circuitpython\u003e`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle \u003chttps://circuitpython.org/libraries\u003e`_\nor individual libraries can be installed using\n`circup \u003chttps://github.com/adafruit/circup\u003e`_.\n\nInstalling to a Connected CircuitPython Device with Circup\n==========================================================\n\nMake sure that you have ``circup`` installed in your Python environment.\nInstall it with the following command if necessary:\n\n.. code-block:: shell\n\n    pip3 install circup\n\nWith ``circup`` installed and your CircuitPython device connected use the\nfollowing command to install:\n\n.. code-block:: shell\n\n    circup install cedargrove_rgb_spectrumtools\n\nOr the following command to update an existing version:\n\n.. code-block:: shell\n\n    circup update\n\nUsage Example\n=============\n\n``grayscale(index, gamma)``\n\nTranslates the normalized index value into a 24-bit RGB integer with gamma\nvisual perception control. The spectral index is a floating point value in the\nrange of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0\nto 1.0 (inclusive); default is 0.8, tuned for TFT displays. If the index or gamma\nvalue is outside of the specified range, the 24-bit RGB output will be limited\nto the minimum (0x0) or maximum (0xFFFFFF) value.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from cedargrove_rgb_spectrumtools.grayscale import index_to_rgb\n    \u003e\u003e\u003e hex(index_to_rgb(0.5, 1.0))\n    '0x8c8c8c'\n\n\n``iron(index, gamma)``\n\nTranslates the normalized index value into a 24-bit RGB integer with gamma\nvisual perception control. The spectral index is a floating point value in the\nrange of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0\nto 1.0 (inclusive); default is 0.5, tuned for TFT displays. If the index or gamma\nvalue is outside of the specified range, the 24-bit RGB output will be limited\nto the minimum (0x0) or maximum (0xFFFFFF) value.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from cedargrove_rgb_spectrumtools.iron import index_to_rgb\n    \u003e\u003e\u003e hex(index_to_rgb(0.5, 1.0))\n    '0xff0000'\n\n\n``stoplight(index, gamma)``\n\nTranslates the normalized index value into a 24-bit RGB integer with gamma\nvisual perception control. The spectral index is a floating point value in the\nrange of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0\nto 1.0 (inclusive); default is 0.5, tuned for TFT displays. If the index or gamma\nvalue is outside of the specified range, the 24-bit RGB output will be limited\nto the minimum (0x0) or maximum (0xFFFFFF) value.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from cedargrove_rgb_spectrumtools.stoplight import index_to_rgb\n    \u003e\u003e\u003e hex(index_to_rgb(0.5, 1.0))\n    ‘'0xffff00'\n\n\n``visible(index, gamma)``\n\nTranslates the normalized index value into a 24-bit RGB integer with gamma\nvisual perception control. The spectral index is a floating point value in the\nrange of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value can be from 0.0\nto 1.0 (inclusive); default is 0.5, tuned for TFT displays. If the index or gamma\nvalue is outside of the specified range, the 24-bit RGB output will be limited\nto the minimum (0x0) or maximum (0xFFFFFF) value.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from cedargrove_rgb_spectrumtools.visible import index_to_rgb\n    \u003e\u003e\u003e hex(index_to_rgb(0.5, 1.0))\n    '0x6dff00'\n\n\n``n_color(index, gamma)``\n\nA class that translates the normalized index value into a 24-bit RGB integer\nwith gamma visual perception control. The spectral index is a floating point\nvalue in the range of 0.0 to 1.0 (inclusive); default is 0.0. The gamma value\ncan be from 0.0 to 3.0 (inclusive); default is 0.55, tuned for TFT displays. If\nthe index or gamma value is outside of the specified range, the 24-bit RGB\noutput will be limited to the minimum (0x0) or maximum (0xFFFFFF) value.\n\nThe class converts a spectrum index value consisting of a positive numeric\nvalue (0.0 to 1.0, modulus of 1.0) to an RGB color value that representing the\nindex position on a graduated and blended multicolor spectrum. The spectrum is\ndefined by a list of colors that are proportionally distributed across the spectrum.\nTwo spectrum modes are currently supported:\n\n* \"light\" mode produces a blended color spectrum that mimics a typical wavelength-of-light representation. The spectrum does not wrap; the first and last colors are not blended with each other.\n\n* \"continuous\" mode blends the color list's first color and last color at the start and end, creating a continuously blended spectrum. This is the default mode.\n\nThis class calculates resultant color values on-the-fly to reduce memory\nconsumption with a slight speed performance sacrifice. Use the\n``n-color_table.Spectrum`` class to improve performance.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from cedargrove_rgb_spectrumtools.n_color import Spectrum\n    \u003e\u003e\u003e # Create Red/Yellow/Green light-style spectrum\n    \u003e\u003e\u003e spectrum = Spectrum([0xFF0000, 0xFFFF00, 0x00FF00], mode=\"light\", gamma=0.6)\n    \u003e\u003e\u003e print(hex(spectrum.color(index=0.36)))\n    0xff9c00\n\n\n``n_color_table(index, gamma)``\n\nThis class functions the same as the ``n_color.Spectrum`` class, calculating\nresultant color values from a pre-compiled internal color list to improve speed\nperformance but with increased memory usage. Use the\n``n-color_spectrum.Spectrum`` class to reduce memory usage.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from cedargrove_rgb_spectrumtools.n_color_table import Spectrum\n    \u003e\u003e\u003e # Create Red/Yellow/Green light-style spectrum\n    \u003e\u003e\u003e spectrum = Spectrum([0xFF0000, 0xFFFF00, 0x00FF00], mode=\"light\", gamma=0.6)\n    \u003e\u003e\u003e print(hex(spectrum.color(index=0.36)))\n        0xff9c00\n\nDocumentation\n=============\nAPI documentation for this library can be found `here \u003chttps://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools/blob/main/media/pseudo_rtd_cedargrove_rgb_spectrumtools.pdf\u003e`_.\n\nFor information on building library documentation, please check out\n`this guide \u003chttps://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1\u003e`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n\u003chttps://github.com/CedarGroveStudios/CircuitPython_RGB_SpectrumTools/blob/HEAD/CODE_OF_CONDUCT.md\u003e`_\nbefore contributing to help this project stay welcoming.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedargrovestudios%2Fcircuitpython_rgb_spectrumtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedargrovestudios%2Fcircuitpython_rgb_spectrumtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedargrovestudios%2Fcircuitpython_rgb_spectrumtools/lists"}