Changeset 140 for trunk/pycha/color.py
- Timestamp:
- 02/03/09 16:08:23 (3 years ago)
- Files:
-
- 1 modified
-
trunk/pycha/color.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pycha/color.py
r96 r140 1 # Copyright (c) 2007-2008by Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>1 # Copyright(c) 2007-2009 by Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com> 2 2 # 3 3 # This file is part of PyCha. … … 18 18 DEFAULT_COLOR = '#3c581a' 19 19 20 20 21 def clamp(minValue, maxValue, value): 21 22 """Make sure value is between minValue and maxValue""" … … 25 26 return maxValue 26 27 return value 28 27 29 28 30 def hex2rgb(hexstring, digits=2): … … 43 45 return r / top, g / top, b / top 44 46 47 45 48 def lighten(r, g, b, amount): 46 49 """Return a lighter version of the color (r, g, b)""" … … 48 51 clamp(0.0, 1.0, g + amount), 49 52 clamp(0.0, 1.0, b + amount)) 53 50 54 51 55 def generateColorscheme(masterColor, keys): … … 63 67 for i, key in enumerate(keys)]) 64 68 69 65 70 def defaultColorscheme(keys): 66 71 """Return the default color scheme (derived from a dark green)""" 67 72 return generateColorscheme(DEFAULT_COLOR, keys) 73 68 74 69 75 def getColorscheme(color, keys): … … 72 78 """ 73 79 return generateColorscheme(colorSchemes.get(color, color), keys) 80 74 81 75 82 # default colors for color schemes … … 80 87 grey='#444444', 81 88 black='#000000', 82 darkcyan='#305755' 89 darkcyan='#305755', 83 90 )
