<div contenteditable class="el">🎊 πŸŽ‰ JS in CSS πŸ’ƒπŸΌ πŸ•ΊπŸΌ </div>

<script>
  CSS.paintWorklet.addModule('/una/pen/xByaoB.js')
</script>
.el {
  --scallopRadius: 10;
  --scallopColor: #8266ff;
  --scallopWeight: 4;
  --background-canvas: (ctx, geom) => {
      const radius = var(--scallopRadius);
      const scallopWeight = var(--scallopWeight);
      const color = `var(--scallopColor)`;
      const height = geom.height;
      const width = geom.width;

      ctx.lineWidth = scallopWeight;
      ctx.strokeStyle = color;
      
      const getSteps = (sizeVal) => {
        return Math.floor(sizeVal / (radius * 2) - 2)
      };

      const getOwnRadius = (sizeVal, otherRad) => {
        const steps = getSteps(sizeVal) + 1;
        const totalSpace = sizeVal - (radius * 2);
        const spaceTaken = steps * (radius * 2);
        let pixelsRemaining = totalSpace - spaceTaken;

        if (otherRad) {
          const radDif = otherRad - radius;
          pixelsRemaining = totalSpace - spaceTaken - radDif;
        };

        const newRadius = radius + ((pixelsRemaining / 2) / (steps + 1));
        return (newRadius);
      };

      const horizRadius = getOwnRadius(width, getOwnRadius(height));
      const vertRadius = getOwnRadius(height, getOwnRadius(width));

      for (let i = 0; i <= getSteps(width); i++) {
        ctx.beginPath();
        ctx.arc(horizRadius + horizRadius + (horizRadius * i * 2), horizRadius + (scallopWeight * 1) , horizRadius, 0, Math.PI, true);
        ctx.stroke();
      }

      for (let i = 0; i <= getSteps(width); i++) {
        ctx.beginPath();
        ctx.arc(horizRadius + horizRadius + (horizRadius * i * 2), height - horizRadius - (scallopWeight * 1), horizRadius, 0, Math.PI, false);
        ctx.stroke();
      }

      for (let i = 0; i <= getSteps(height); i++) {
        ctx.beginPath();
        ctx.arc(vertRadius + (scallopWeight * 1), vertRadius + vertRadius + (vertRadius * i * 2), vertRadius, Math.PI * 0.5,  Math.PI * 1.5, false);
        ctx.stroke();
      }

      for (let i = 0; i <= getSteps(height); i++) {
        ctx.beginPath();
        ctx.arc(width - vertRadius - (scallopWeight * 1), vertRadius + vertRadius + (vertRadius * i * 2), vertRadius, Math.PI * 0.5,  Math.PI * 1.5, true);
        ctx.stroke();
      }
  };
  background: paint(background-canvas); 
}

.el:after {
  --offset: 3px;
  content: '';
  width: 100%;
  height: 100%;
  position: absolute;
  top: var(--offset); 
  left: var(--offset);
  z-index: -1;
  filter: hue-rotate(50deg) opacity(0.4);
  background: paint(background-canvas); 
}


/* Other style things */
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.el {
  padding: 0.5rem;
  font-size: 5.5rem;
  font-family: monospace;
  padding: 2rem;
  text-align: center;
  position: relative;
  color: #3696ff;
  max-width: 70vw;
}
/*
This CodePen's JS file has been "hijacked" to serve as the paint worklet file. The if check below ensures the code only runs when referenced as such. JavaScript for the page is at the top of the HTML. I'm only doing this to squeeze everything into one CodePen.

IMPORTANT: If you fork, update the CodePen JS file path in the HTML.

ALSO IMPORTANT: If you edit code here, disable cache and reload. Live preview won't pick up changes in the paint worklet.
*/

if (typeof registerPaint !== 'undefined') {
  registerPaint('background-canvas', class {
    static get inputProperties() {
        return ['--background-canvas'];
    }
    paint(ctx, geom, properties) {
        eval(properties.get('--background-canvas').toString())(ctx, geom, properties);
    }
  })
}

External CSS

  1. https://fonts.googleapis.com/css?family=Mukta+Mahee:400,700
  2. https://use.fontawesome.com/releases/v5.0.6/css/all.css

External JavaScript

This Pen doesn't use any external JavaScript resources.