• HEX: #96d1e3
  • RGB: rgb(150, 209, 227)
  • HEX: #2398c8
  • RGB: rgb(35, 152, 200)
  • HEX: #dbf3f4
  • RGB: rgb(219, 243, 244)
  • HEX: #51add1
  • RGB: rgb(81, 173, 209)
  • HEX: #448bba
  • RGB: rgb(68, 139, 186)
  Download

What is Swatchify?

Swatchify is a WordPress plugin that grabs an image from a post or image file and creates a swatch to go with it.

Implement Swatchify

In its simplest form Swatchify is a shortcode. This shortcode can be used throughout your theme on any post, page, or custom post type in either the post content or in the php.

When implemented on a page Swatchify will grab an image, extract the colors, associate those colors to your post using custom color taxonomies and meta, and then output a swatch with the style of your choosing.

Base Shortcode

[swatchify]

Shortcode Parameters

[swatchify style="" image="" quality=""]

Style

  • Requirement: Optional
  • Default: default
  • Options: (default | small-circles | small-squares | small-diamonds | small-bar | medium-bar | tall-bar full-bar | collage-vertical | collage-horizontal)

The style is what determins how your swatch will look. Choose from one of the piped options above.

Image

  • Requirement: Optional
  • Default: null
  • Options: Any properly formatted image link.

If provided swatchify will use this image to create your swatch. If this parameter is not provided swatchify grabs the featured image attached to your post. If there is no featured image then it looks for an image in the body text of the post. If there is no image to be found the swatch will fail.

Quality

  • Requirement: Optional
  • Default: 10
  • Options: Any number 1-20

Depending on where you are placing swatchify, and how many swatches you are trying to generate you will want to change the quality of the image parsing. 1 = highest, 10 = default, and you can go higher if you wish to spend less memory on swatch generation.

In Theme Files

<?php echo do_shortcode('[swatchify]'); ?>

Examples

Default

[swatchify style="default"]
  • HEX: #96d1e3
  • RGB: rgb(150, 209, 227)
  • HEX: #2398c8
  • RGB: rgb(35, 152, 200)
  • HEX: #dbf3f4
  • RGB: rgb(219, 243, 244)
  • HEX: #51add1
  • RGB: rgb(81, 173, 209)
  • HEX: #448bba
  • RGB: rgb(68, 139, 186)

Small Circles

[swatchify style="small-circles"]
  • HEX: #96d1e3
  • RGB: rgb(150, 209, 227)
  • HEX: #2398c8
  • RGB: rgb(35, 152, 200)
  • HEX: #dbf3f4
  • RGB: rgb(219, 243, 244)
  • HEX: #51add1
  • RGB: rgb(81, 173, 209)
  • HEX: #448bba
  • RGB: rgb(68, 139, 186)

Small Squares

[swatchify style="small-squares"]
  • HEX: #96d1e3
  • RGB: rgb(150, 209, 227)
  • HEX: #2398c8
  • RGB: rgb(35, 152, 200)
  • HEX: #dbf3f4
  • RGB: rgb(219, 243, 244)
  • HEX: #51add1
  • RGB: rgb(81, 173, 209)
  • HEX: #448bba
  • RGB: rgb(68, 139, 186)

Small Diamonds

[swatchify style="small-diamonds"]
  • HEX: #96d1e3
  • RGB: rgb(150, 209, 227)
  • HEX: #2398c8
  • RGB: rgb(35, 152, 200)
  • HEX: #dbf3f4
  • RGB: rgb(219, 243, 244)
  • HEX: #51add1
  • RGB: rgb(81, 173, 209)
  • HEX: #448bba
  • RGB: rgb(68, 139, 186)

Small Bar

[swatchify style="small-bar"]
  • HEX: #96d1e3
  • RGB: rgb(150, 209, 227)
  • HEX: #2398c8
  • RGB: rgb(35, 152, 200)
  • HEX: #dbf3f4
  • RGB: rgb(219, 243, 244)
  • HEX: #51add1
  • RGB: rgb(81, 173, 209)
  • HEX: #448bba
  • RGB: rgb(68, 139, 186)

Medium Bar

[swatchify style="medium-bar"]
  • HEX: #96d1e3
  • RGB: rgb(150, 209, 227)
  • HEX: #2398c8
  • RGB: rgb(35, 152, 200)
  • HEX: #dbf3f4
  • RGB: rgb(219, 243, 244)
  • HEX: #51add1
  • RGB: rgb(81, 173, 209)
  • HEX: #448bba
  • RGB: rgb(68, 139, 186)

Tall Bar

[swatchify style="tall-bar"]
  • HEX: #96d1e3
  • RGB: rgb(150, 209, 227)
  • HEX: #2398c8
  • RGB: rgb(35, 152, 200)
  • HEX: #dbf3f4
  • RGB: rgb(219, 243, 244)
  • HEX: #51add1
  • RGB: rgb(81, 173, 209)
  • HEX: #448bba
  • RGB: rgb(68, 139, 186)

Full Bar

[swatchify style="full-bar"]
  • HEX: #96d1e3
  • RGB: rgb(150, 209, 227)
  • HEX: #2398c8
  • RGB: rgb(35, 152, 200)
  • HEX: #dbf3f4
  • RGB: rgb(219, 243, 244)
  • HEX: #51add1
  • RGB: rgb(81, 173, 209)
  • HEX: #448bba
  • RGB: rgb(68, 139, 186)

Collage Vertical

[swatchify style="collage-vertical" image="http://www.sparqvault.com/wp-content/uploads/2016/12/tumblr_nk0115ZNox1sxuwguo1_1280.jpg" quality="12"]
  • HEX: #e5dfd8
  • RGB: rgb(229, 223, 216)
  • HEX: #48190c
  • RGB: rgb(72, 25, 12)
  • HEX: #8b3f1e
  • RGB: rgb(139, 63, 30)
  • HEX: #c18948
  • RGB: rgb(193, 137, 72)
  • HEX: #998c80
  • RGB: rgb(153, 140, 128)

Collage Horizontal

[swatchify style="collage-horizontal" image="http://www.sparqvault.com/wp-content/uploads/2016/12/tumblr_o0s3b6J5JV1tvh80lo1_1280.jpg" quality="12"]
  • HEX: #23242d
  • RGB: rgb(35, 36, 45)
  • HEX: #82615f
  • RGB: rgb(130, 97, 95)
  • HEX: #534443
  • RGB: rgb(83, 68, 67)
  • HEX: #655655
  • RGB: rgb(101, 86, 85)
  • HEX: #5d4c54
  • RGB: rgb(93, 76, 84)

Made Possible With...

This plugin wouldn't exist without Kevin Subileua's Color Thief PHP class, the WordPress Plugin Boilerplate Generator by Devin Vinson, kevinlebrun's Colors.php, and colorName.php from this dude, and of course WordPress!