Package rekall :: Package ui :: Module colors
[frames] | no frames]

Module colors

source code

Various functions for handling colors. Used mainly for visualizing output of plugins with heatmaps (for now).

Most of the code below is made to match this color chart: http://en.wikipedia.org/wiki/File:Xterm_256color_chart.svg

The colorspace conversions are thin wrappers around colorsys, except for the code to handle XTerm colors, which is my own work.


Author: Adam Sindelar <adamsh@google.com>

Functions
 
ArbitraryStepFunction(value, steps) source code
 
ChannelStepFunction(intensity) source code
 
GreyscaleStepFunction(intensity) source code
 
RGBToXTerm(red, green, blue)
Convert RGB values (0-255) to the closes XTerm color.
source code
 
XTermToRGB(xterm)
Convert the XTerm color (0-255) to an RGB equivalent.
source code
 
RGBToHSL(red, green, blue) source code
 
RGBToYIQ(red, green, blue) source code
 
HSLToRGB(hue, saturation, luminosity) source code
 
YIQToRGB(y, i, q) source code
 
YIQTextForBackground(y, i, q)
Compute the foreground color, given the background color.
source code
 
RGBTextForBackground(red, green, blue)
Compute the foreground color, given the background color.
source code
 
XTermTextForBackground(xterm)
Compute the foreground color, given the background color.
source code
 
BlendRGB(x, y, wx=1, wy=1)
Blend RGB colors x and y, optionally using assigned weights wx and wy.
source code
 
HeatToHSL(heat, greyscale=False)
Given heat (0-1.0), compute the color to represent it on a heatmap.
source code
 
HeatToRGB(heat, greyscale=False) source code
 
HeatToXTerm(heat, greyscale=False) source code
Variables
  XTERM16 = ((0, 0, 0), (128, 0, 0), (0, 128, 0), (128, 128, 0),...
XTerm has 16 special colors, as listed above.
  XTERM_CHANNEL_STEPS = [0, 95, 135, 175, 215, 255]
XTerm color space is sparse at low luminosity.
  __package__ = 'rekall.ui'
Function Details

HeatToHSL(heat, greyscale=False)

source code 
Given heat (0-1.0), compute the color to represent it on a heatmap.

Arguments:
    Greyscale: If True, use luminosity instead of hue.


Variables Details

XTERM16

XTerm has 16 special colors, as listed above.

Value:
((0, 0, 0),
 (128, 0, 0),
 (0, 128, 0),
 (128, 128, 0),
 (0, 0, 128),
 (128, 0, 128),
 (0, 128, 128),
 (192, 192, 192),
...