Skip to content

Instantly share code, notes, and snippets.

@sempostma
Created October 20, 2020 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sempostma/1009babbb65d40c76b8b032748d87413 to your computer and use it in GitHub Desktop.
Save sempostma/1009babbb65d40c76b8b032748d87413 to your computer and use it in GitHub Desktop.
var gradient = ["#11a7b6", "#29b827", "#f8bf00", "#f66d31", "#ef66a0"]
var parts = gradient.map((x, i, self) => `${x} ${i / self.length * 100}%, ${x} ${(i + 1) / self.length * 100}%`)
var result = `linear-gradient(90deg, ${parts.join(', ')})`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment