Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Fix toHex regex first test #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/jquery.colorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
**/
toHex : function (color) {
// If we have a standard or shorthand Hex color, return that value.
if (color.match(/[0-9A-F]{6}|[0-9A-F]{3}$/i)) {
if (color.match(/^(#?)[0-9A-F]{6}$/i) || color.match(/^(#?)[0-9A-F]{3}$/i)) {
return (color.charAt(0) === "#") ? color : ("#" + color);

// Alternatively, check for RGB color, then convert and return it as Hex.
Expand Down