Search code examples
csscss-shapes

How to mirror VueJS' logo properly in CSS-only?


I'm trying to replicate the VueJS logo with a CSS-only approach, not by importing an SVG or anything.

I've use clippy to have some proper clip-path, but still there is no way for me to find the proper rotation between the arms of the logo.


This is what I tried so far

.wrapper {
  height: 100svh;
  display: flex;
  flex-direction: row;
  align-items: center;
  transform: rotate(-60deg)
}

.wrapper div {
  width: 250px;
  height: 45px;
}

.left {
  transform: rotate(-60deg) translate(60%, 200%) scale(-1);
}

.green {
  background-color: #42b883;
  clip-path: polygon(33px 0, calc(100% - 33px) 0, 100% 100%, 0% 100%);
}

.blue {
  background-color: #35495e;
  clip-path: polygon(
    66px 0,
    calc(100% - 66px) 0,
    calc(100% - 33px) 100%,
    33px 100%
  );
}
<div class="wrapper">
  <main class="left">
    <div class="blue"></div>
    <div class="green"></div>
  </main>
  <main class="right">
    <div class="blue"></div>
    <div class="green"></div>
  </main>
</div>

I've tried various translations, transforms etc, but none of them seem to be logical, while I thought that applying a 60-degree rotation would be enough.
Turns out it totally didn't.


Solution

  • I did a bunch of CSS-only single element logos and VueJS is the first of the list.

    Only 4 declarations and one value to control the size

    .vue {
      width: 200px; /* control the size */
      aspect-ratio: 1.18;
      background: conic-gradient(from -30deg at 50% 60%, #34495e 60deg, #41b783 0);
      clip-path: polygon(0 0, 39% 0, 50% 23%, 61% 0, 100% 0, 50% 100%);
    }
    <div class="vue"></div>