Snippets Collections
func addshadow(top: Bool,
              left: Bool,
              bottom: Bool,
              right: Bool,
              shadowRadius: CGFloat) {
        self.backgroundColor = UIColor.white
        self.layer.masksToBounds = false
        self.layer.cornerRadius = 8
        self.layer.shadowOffset = CGSize(width: 0.0, height: 0.0)
        self.layer.shadowRadius = shadowRadius
        self.layer.shadowOpacity = 0.4
        self.layer.shadowColor = UIColor(red: 6.0/255, green: 141.0/255, blue: 144.0/255, alpha: 1.0).cgColor
        let path = UIBezierPath()
        var x: CGFloat = 0
        var y: CGFloat = 0
        var viewWidth = self.frame.width
        var viewHeight = self.frame.height
        // here x, y, viewWidth, and viewHeight can be changed in
        // order to play around with the shadow paths.
        if (!top) {
          y+=(shadowRadius+1)
        }
        if (!bottom) {
          viewHeight-=(shadowRadius+1)
        }
        if (!left) {
          x+=(shadowRadius+1)
        }
        if (!right) {
          viewWidth-=(shadowRadius+1)
        }
        // selecting top most point
        path.move(to: CGPoint(x: x, y: y))
        // Move to the Bottom Left Corner, this will cover left edges
        /*
         |☐
         */
        path.addLine(to: CGPoint(x: x, y: viewHeight))
        // Move to the Bottom Right Corner, this will cover bottom edge
        /*
         ☐
         -
         */
        path.addLine(to: CGPoint(x: viewWidth, y: viewHeight))
        // Move to the Top Right Corner, this will cover right edge
        /*
         ☐|
         */
        path.addLine(to: CGPoint(x: viewWidth, y: y))
        // Move back to the initial point, this will cover the top edge
        /*
         _
         ☐
         */
        path.close()
        self.layer.shadowPath = path.cgPath
      }
.divWithSlightShadow {
  background: #FFFFFF;
    border-radius: 6px;
    border: 1px solid #EBEBEB; // <*** This is the key!
    width: 356px;
    box-shadow: 0 4px 8px 0 rgb(0 0 0 / 4%);
    padding: 24px;
}
.shadow {
   -moz-box-shadow:    inset 0 0 10px #000000;
   -webkit-box-shadow: inset 0 0 10px #000000;
   box-shadow:         inset 0 0 10px #000000;
}
star

Tue Mar 15 2022 04:14:56 GMT+0000 (UTC)

#ios #swift #shadow
star

Wed Feb 16 2022 16:02:24 GMT+0000 (UTC)

#light #shadow #ui
star

Sat Jan 08 2022 01:45:06 GMT+0000 (UTC) https://css-tricks.com/snippets/css/css-box-shadow/

#css #shadow

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension