This is a migrated thread and some comments may be shown as answers.

Fill Color with CSS class

2 Answers 263 Views
Drawing API
This is a migrated thread and some comments may be shown as answers.
Mattia
Top achievements
Rank 1
Mattia asked on 29 Sep 2015, 09:40 AM

Hi Telerik Team! Is it possible to fill, for example a rectangle, with a color based on CSS class, instead that the hexadecimal code ? I mean, I would like to assign the color of a rectangle based on some colors that change according the theme's color palette, for example the colors displayed in dataviz different series or the color of notifications.But for doing this I have to set a CSS class on fill.color field of the drawing object.

If this isn't possible, do you have any other suggestion to color some drawing object according the theme's color palette?

Thanks !

2 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 02 Oct 2015, 07:42 AM
Hello,

Please accept my apologies for the delayed response.

The shapes in the Drawing API are technically not part of the DOM unless you render them as SVG (technically VML as well).

We tend not to expose SVG specific implementation details such as class name.
If we do you'll get different output when rendering to PDF and Canvas.

What you can do instead is to obtain a the set color via the computed style. See this snippet for a demo.
Does this make sense?

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Mattia
Top achievements
Rank 1
answered on 05 Oct 2015, 10:09 AM

Ok Tsonev, thanks for the reply, I've understood the example, but after some brainstorming with my team mates we have decided to keep the color fixed. Also because we use the color of a shape as category label. 

Mattia Thiella

Tags
Drawing API
Asked by
Mattia
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Mattia
Top achievements
Rank 1
Share this question
or