Cell Background Color

967 views
Skip to first unread message

nil...@googlemail.com

unread,
Apr 24, 2009, 3:35:26 AM4/24/09
to python-excel
Hi all,

where can I find a table that connects

badBG2.pattern_fore_colour = 0x22 with the corresponding color ?

e.g.

0x22 : yellow
0x35 : orange
0xa : red
...

I am looking for light green.

Thanks in advance.

Nils

Chris Withers

unread,
Apr 24, 2009, 3:44:14 AM4/24/09
to python...@googlegroups.com
nil...@googlemail.com wrote:
> badBG2.pattern_fore_colour = 0x22 with the corresponding color ?
>
> e.g.
>
> 0x22 : yellow
> 0x35 : orange
> 0xa : red
> ...
>
> I am looking for light green.

from xlwt import easyxf
style = easyxf('pattern: pattern solid, fore_colour light_green')

The full list is only currently available in easyxf.py in the xlwt
distribution.

cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk

John Machin

unread,
Apr 24, 2009, 5:16:02 AM4/24/09
to python...@googlegroups.com
On 24/04/2009 5:35 PM, nil...@googlemail.com wrote:
> Hi all,

Hi Nils,

> where can I find a table that connects
>
> badBG2.pattern_fore_colour = 0x22 with the corresponding color ?

Using easyxf (see the docs, and then as the docs say, "Refer to the
examples in the file .../examples/xlwt_easyxf_simple_demo.py and to the
xf_dict dictionary in Style.py") is much better than the old
poking-values-into-attributes way.

There is a mapping from colour names to colour indexes in Style.py. Note
that the names are what Excel 2003 calls them. There is very little
correspondence with the web (CSS etc) colours that you may be used to;
there are many RGB values that are in one mapping and not the other;
sometimes the names given to a common RGB value differ widely/weirdly.

Looking at the info on colours and the palette in the xlrd docs might be
useful.

>
> e.g.
>
> 0x22 : yellow
> 0x35 : orange
> 0xa : red
> ...
>
> I am looking for light green.

HTH,
John


nil...@googlemail.com

unread,
Apr 24, 2009, 5:37:04 AM4/24/09
to python-excel
Great. Thank you very much for your answers.

Nils


On 24 Apr., 11:16, John Machin <sjmac...@lexicon.net> wrote:
Reply all
Reply to author
Forward
0 new messages