DEV Community

Naman Sachdeva
Naman Sachdeva

Posted on

I built a mood-based gradient & quote generator โ€” powered by AI ๐ŸŽจ

Hey Guys ๐Ÿ‘‹
Iโ€™m still learning โ€” not a full-stack expert, not building a huge startup โ€” just someone who likes playing with code and visuals.

I recently made this little tool: you type a mood (like โ€œdreamy oceanโ€, โ€œsunset hustleโ€, or โ€œcalm coding flowโ€) and it generates a background gradient and a fresh motivational quote for you. If youโ€™ve got your own server/API key, it can even call an AI backend to make totally custom gradients + quotes.

โœ… What it does

  • If you pick from predefined moods (Happy, Calm, Sad, Energetic), it uses preset gradients + quotes.
  • If you choose โ€œAIโ€ mode and type your own prompt, the tool will:
    1. Send the prompt to a backend endpoint /generate-gradient
    2. Receive a custom gradient (2 HEX colours) + a quote from AI
    3. Apply the gradient and adjust the text colour automatically so itโ€™s always readable

๐Ÿ›  Why I built it

I wanted something more than static themes: a tool that feels your mood and paints accordingly. Also, I found learning this colour-contrast logic (checking brightness and adjusting text colour) surprisingly fun.

๐Ÿงฉ Tech bits

  • Frontend: HTML + CSS + vanilla JS โ€” no big framework.
  • Backend (optional): Express + Node โ†’ endpoint accepts JSON { prompt } and returns { gradient, quote }.
  • Bonus: client-side checks for URL validity, fallback when server is missing, and smooth background + text transition. ๐Ÿš€ Try it out

Would love your feedback โ€” is the colour contrast good? Does the quote feel fresh?

Thanks for checking this out โ€” and if youโ€™re building your own little tool too, drop your link below!

๐Ÿ’ฌ Would love to hear your thoughts โ€” drop a comment if you tried it, found a bug, or have an idea to improve it!
โ€”Naman Sachdeva

Top comments (0)