Creative Coding with SVGs
zuubaDigital

Colors

codepen practice page

css keywords

You can use all the CSS color keywords to set colors in your SVG. A complete list of these keywords can be found here.

1 2 3 <circle cx="250" cy="250" r="250" stroke="black" fill="seagreen" />

hexadecimal values

A hexadecimal number is really three hexadecimal integers, one each for the Red, Green, and Blue color channels.

#RRGGBB

1 2 3 <circle cx="250" cy="250" r="250" stroke="black" fill="#2e8b57 " />
here is the hex value for the seagreen color we used above

rgb values

rgb stands for Red, Green, and Blue. The range of values for each color channel: 0-255

1 2 3 <circle cx="250" cy="250" r="250" stroke="black" fill="rgb(46,139,87)" />

hsl values

hsl stands for Hue Saturation, and Lightness

  • hue: value from 0-360
  • saturation: percentage value 0%-100%
  • lightness: percentage value 0%-100%
1 2 3 <circle cx="250" cy="250" r="250" stroke="black" fill="hsl(146, 50%, 36%)" />