Trees | Indices | Help |
|
---|
|
1 # trml2pdf - An RML to PDF converter 2 # Copyright (C) 2003, Fabien Pinckaers, UCL, FSA 3 # 4 # This library is free software; you can redistribute it and/or 5 # modify it under the terms of the GNU Lesser General Public 6 # License as published by the Free Software Foundation; either 7 # version 2.1 of the License, or (at your option) any later version. 8 # 9 # This library is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 # Lesser General Public License for more details. 13 # 14 # You should have received a copy of the GNU Lesser General Public 15 # License along with this library; if not, write to the Free Software 16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 18 from reportlab.lib import colors 19 import re 20 21 allcols = colors.getAllNamedColors() 22 23 regex_t = re.compile('\(([0-9\.]*),([0-9\.]*),([0-9\.]*)\)') 24 regex_h = re.compile('#([0-9a-zA-Z][0-9a-zA-Z])([0-9a-zA-Z][0-9a-zA-Z])([0-9a-zA-Z][0-9a-zA-Z])') 2527 global allcols 28 if col_str in allcols.keys(): 29 return allcols[col_str] 30 res = regex_t.search(col_str, 0) 31 if res: 32 return (float(res.group(1)),float(res.group(2)),float(res.group(3))) 33 res = regex_h.search(col_str, 0) 34 if res: 35 return tuple([ float(int(res.group(i),16))/255 for i in range(1,4)]) 36 return colors.red37
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Mon Oct 1 23:57:10 2007 | http://epydoc.sourceforge.net |