Skip to content
/ Hue Public
forked from TopShelfCraft/Hue

A slightly better color picker for CraftCMS

License

Notifications You must be signed in to change notification settings

miranj/Hue

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hue

A slightly better color picker for CraftCMS

by Michael Rog
https://topshelfcraft.com

TL;DR.

The Hue fieldtype works almost identically to Craft's native Color field, with some added bonuses:

  • You can directly edit the color code as text.
  • You can specify a default color in the field settings.
  • You can clear (i.e. un-set) field values
  • You can set the default color to be empty.
  • The ColorModel gives you access to nice helper variables.

Screenshot


Working with Hue fields

When you access a Hue field in your templates, its value will either be null (if there is no color set), or a ColorModel.

ColorModel properties

A ColorModel has the following methods/properties:

getHex() / .hex

Returns the string representation of the color in hexidecimal format, including the # at the beginning.

getRgb() / .rgb

Returns the string representation of the color in RGB format, i.e. "0,255,0" for blue.

getRed() / .red

Returns the numeric value of the red channel, from 0-255.

getGreen() / .green

Returns the numeric value of the green channel, from 0-255.

getBlue() / .blue

Returns the numeric value of the blue channel, from 0-255.

What are the system requirements?

Craft 2.5+ and PHP 5.4+

I found a bug.

Please open a GitHub Issue, submit a PR to the dev branch, or just email me to let me know.


Contributors:

About

A slightly better color picker for CraftCMS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 79.6%
  • HTML 20.4%