Fill Color with CSS class

3 posts, 0 answers
  1. Mattia
    Mattia avatar
    23 posts
    Member since:
    Mar 2015

    Posted 29 Sep 2015 Link to this post

    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. T. Tsonev
    T. Tsonev avatar
    2791 posts

    Posted 02 Oct 2015 Link to this post


    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?

    T. Tsonev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Mattia
    Mattia avatar
    23 posts
    Member since:
    Mar 2015

    Posted 05 Oct 2015 in reply to T. Tsonev Link to this post

    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

Back to Top