As I was composing this email there was a voice in the back of my head
saying "you can do that already...", but when I looked through the code for
"transparent" I didn't find anything, so I figured it was something on a
branch that just needed to be merged.

10 seconds after hitting "Send" (*after* the "undo send" option was already
gone in gmail), I remembered that this is the "clearBackground" drawing
option. If you set that option to False, then no background will be drawn
(i.e. it will be transparent):

In [21]: d2d = rdMolDraw2D.MolDraw2DCairo(300,300)

In [22]: opts = d2d.drawOptions()

In [23]: opts.clearBackground=False

In [24]: d2d.DrawMolecule(dm)

In [25]: d2d.FinishDrawing()


Best,
-greg


On Sun, Sep 24, 2017 at 5:25 AM, Greg Landrum <greg.land...@gmail.com>
wrote:

> Hi Michal,
>
> This is now one of the draw options;
>
> In [3]: d2d = rdMolDraw2D.MolDraw2DSVG(300,300)
>
> In [4]: opts = d2d.drawOptions()
>
> In [6]: opts.setBackgroundColour((1,1,0))
>
>
> You can set the default highlightColour the same way.
>
> There's not currently a "make it transparent" option, but that would be a
> nice thing for us to figure out how to do. I will take a look
>
> -greg
>
>
> On Wed, Sep 20, 2017 at 1:08 PM, Michał Nowotka <mmm...@gmail.com> wrote:
>
>> Hi,
>>
>> In the old drawing code it was possible to pass drawing options to the
>> MolToImage method.
>>
>> Lookng at the C++ signature of the new DrawMolecule
>>
>> DrawMolecule( (MolDraw2D)self, (Mol)mol, (object)highlightAtoms,
>> (object)highlightBonds [, (object)highlightAtomColors=None [,
>> (object)highlightBondColors=None [, (object)highlightAtomRadii=None [,
>> (int)confId=-1 [, (str)legend='']]]]]) -> None
>>
>> I can see it's possible to change higlight colors but I need to be
>> able to change background color of the png image. I want to to be
>> transparent by default but I should be able to set it to any other
>> solid color, is that possible?
>>
>> Cheers,
>> Michał
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to