Skip to content

A Jetpack Compose demo of vibrant Mesh Gradients using @sinasamaki’s modifier, showcased on custom UI components and shapes

Notifications You must be signed in to change notification settings

Shoaibkhalid65/MeshGradients

Repository files navigation

🌈 Mesh Gradients in Jetpack Compose

Mesh Gradients are one of the most visually captivating modern design trends, often used in UI/UX design to create vibrant, fluid, and organic color backgrounds. Unlike traditional linear or radial gradients, mesh gradients allow multiple colors to blend across different control points, giving a smooth, natural, and abstract look.

This repository demonstrates Mesh Gradients in Jetpack Compose, exploring their use with custom shapes, custom UI components, and Canvas API.


✨ What’s Inside

  • ✅ Mesh Gradients implementation in Jetpack Compose.
  • ✅ Using @sinasamaki’s Mesh Gradient Modifier (article, video).
  • ✅ Demonstrated gradients on custom UI components (Cards, Buttons, etc.).
  • ✅ Built responsive custom shapes with the Canvas API.
  • ✅ Added a helper class for CouponShape (with arc cutouts)

📹 Demo Video

mesh_gradients.mp4

📂 Code Locations

  • 🔘 Button Mesh Gradientpractice/Sample6.kt
  • 🃏 Cards Mesh GradientCardsScreen.kt
  • CouponShape Helper ClasscustomShapes/CouponShape.kt

🧩 CouponShape Helper Class

The CouponShape is a reusable shape with arc cutouts on the horizontal sides. It’s fully responsive, customizable, and comes with two public constructors:

  1. By radius height → Takes radius height and generates arcs automatically.
  2. By arc count & space height → Takes number of arcs + space height, and auto-calculates arcs.

📌 Code: customShapes/CouponShape.kt


🔗 Useful References

Official Mesh Gradient Work by @sinasamaki


Third-Party Library (Not Used in This Repo)

While this project only uses @sinasamaki’s modifier, there is also a 3rd-party Mesh Gradient library for Compose:


🎨 Color & Gradient Resources


⭐ Support

If you find this repository helpful, consider giving it a star ⭐ — it motivates me to create and share more awesome Compose experiments!


About

A Jetpack Compose demo of vibrant Mesh Gradients using @sinasamaki’s modifier, showcased on custom UI components and shapes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages