Skip to content
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
8 changes: 8 additions & 0 deletions spectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
showInitial: false,
showPalette: false,
showPaletteOnly: false,
showHexText: false,
hideAfterPaletteSelect: false,
togglePaletteOnly: false,
showSelectionPalette: true,
Expand Down Expand Up @@ -767,6 +768,13 @@
previewElement.removeClass("sp-clear-display");
previewElement.css('background-color', 'transparent');

//if showHexText is enabled, then change the text to the correct val, and update its color based on if it should be black/white
if(opts.showHexText){
var HexTextColor = tinycolor(realColor).isLight() ? "#000000": "#FFFFFF";
previewElement.text(realColor.toHexString());
previewElement.css("color", HexTextColor);
}

if (!realColor && allowEmpty) {
// Update the replaced elements background with icon indicating no color selection
previewElement.addClass("sp-clear-display");
Expand Down