Inkscape.org
Beginners' Questions Round rectangle with two (fill & stroke) colors.
  1. #1
    theogiraudet theogiraudet @theogiraudet

    Hey!

    This is a really basic question, but this is the first time I've tried to design something from scratch in SVG, and I'm struggling…
    I want to reproduce this:

    So a rounded rectangle perfectly divides in two by the diagonal, with a different color and border color for each part.
    I tried to start from a basic rounded rectangle and divide it in two using a triangle shape but:

    - I have a border replacing the diagonal (logic since this is now a border of a "triangle").
    - The round angle between my two parts, at the "junction part", is not really round anymore (cf screenshot in gallery).

    I'll be grateful if you have any hints or tutorials on how to realize such a shape.

    Thanks!

     

    Screenshot
  2. #2
    Polygon Polygon @Polygon🌶
    *

    What I‘d try: draw one rounded rectangle and convert with Path->Object to Path. Then place nodes where you want the diagonal start respectice ends. Select these 2 nodes and hit „Break path at selected nodes“. Now go Path->Break apart. You have now 2 separate objects ready to add color to fill and stroke. If you want a single color stroke you can simply use a gradient with 2 colors and 4 stops - 2 of different colors but in the same spot as a fill color.

    (Wasn´t in front of Inkscape 😅)

  3. #3
    David248 David248 @David248
    *

    Polygon already answered with these two smart methods. I'd just add :

    Polygon

    Select these 2 nodes and hit „Disconnect selected nodes“.

    You mean : (use node tool and) hit "Break path at selected nodes" button (5th button from left in tool control bar).

    Polygon

    If you want a single color stroke you can simply use a gradient with 2 colors and 4 stops - 2 of different colors but in the same spot as a fill color.

    For the second method (with one single rectangle and gradients), You can also use a two stops gradient (one red, one green) :

    • use snapping to guides + nodes (no need to specify one type of node) + objects rotation center
    • drag from rulers two (vertical and horizontal) guides on rectangle center
    • set a gradient as a fill using fill and stroke panel
    • with node tool, move the gradient handles to guides intersection. You might have to move one handle very slightly (disable snapping) if fill turns brown.
    • in fill and stroke panel, set orientation to 45°

  4. #4
    Polygon Polygon @Polygon🌶

    Or like so:

  5. #5
    David248 David248 @David248
    👍

    Thanks, Polygon, a better solution.

  6. #6
    theogiraudet theogiraudet @theogiraudet

    Hey!
    Thanks a lot for your help with your instruction, I managed to do what I wanted :D

Inkscape Inkscape.org Inkscape Forum Beginners' Questions Round rectangle with two (fill & stroke) colors.