Color::Theme - Color theme structure


This document describes version 0.10.1 of Color::Theme (from Perl distribution Color-Theme), released on 2018-02-25.


This module specifies a structure for color themes. The distribution also comes with utility routines and roles for managing color themes in applications.


Color theme is a DefHash containing these keys: v (float, should be 1.1), name (str), summary (str), no_color (bool, should be set to 1 if this is a color theme without any colors), and colors (hash, the colors for items; hash keys are item names and hash values are color values).

A color value should be a scalar containing a single color code which is 6-hexdigit RGB color (e.g. ffc0c0), or a hashref containing multiple color codes, or a coderef which should produce a color code (or a hash of color codes).

Multiple color codes are used to support foreground/background values or ANSI color codes that are not representable by RGB, among other things. The keys are: fg (RGB value for foreground), bg (RGB value for background), ansi_fg (ANSI color escape code for foreground), ansi_bg (ANSI color escape code for background). Future keys like css can be defined.

Allowing coderef as color allows for flexibility, e.g. for doing gradation border color, random color, etc. See, for example, Text::ANSITable::ColorTheme::Demo. Code will be called with ($self, %args) where %args contains various information, like name (the item name being requested), etc. In Text::ANSITable, you can get the row position from $self->{_draw}{y}.


Please visit the project's homepage at


Source repository is at


Please report any bugs or feature requests on the bugtracker website

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.


perlancar <>


This software is copyright (c) 2018, 2014 by

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.