Skip to content

Instantly share code, notes, and snippets.

@kyleshevlin
Created January 9, 2020 18:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kyleshevlin/f419b46be051144bba699df51dd0d98d to your computer and use it in GitHub Desktop.
Save kyleshevlin/f419b46be051144bba699df51dd0d98d to your computer and use it in GitHub Desktop.
Parameterized Repeated Hexagons SVG
const hexagons = ({
fill = COLORS.white.replace('#', ''),
opacity = 0.08,
width = 28,
}) => {
const height = (width * 49) / 28
return `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${width}' height='${height}' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg id='hexagons' fill='%23${fill}' fill-opacity='${opacity}' fill-rule='nonzero'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")
`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment