How to use the tinycolor2/tinycolor.mostReadable function in tinycolor2

To help you get started, we’ve selected a few tinycolor2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HighCoordination / trueChart-Menubar4Sense / tcmenu / src / js / Components / PropertyPanel / ColorPickerComponent.js View on Github external
scope.setColor = function(color){
			let tinColor = tinycolor(color);
			UtilService.setRefValue(scope.data, scope.definition.ref, tinColor.toRgbString());
			$element.find(".colorPalette").css("background-color", tinColor.toRgbString());
			$element.find(".colorPaletteIcon").css("color", tinycolor.mostReadable( tinColor , ['#595959', '#fff']).toHexString());
			scope.$emit("saveProperties");
		};
github HighCoordination / trueChart-Menubar4Sense / tcmenu / src / js / Components / PropertyPanel / ColorPickerComponent.js View on Github external
let colorObj = {};

			if(!color){
				return;
			}

			if(!color.tiny){
				colorObj.tiny = tinycolor(color);
			}else{
				colorObj = color;
			}

			if(colorObj.tiny.getAlpha() < 0.5){
				$element.find(".colorPaletteIcon").css("color", '#595959');
			}else{
				$element.find(".colorPaletteIcon").css("color", tinycolor.mostReadable( colorObj.tiny , ['#595959', '#fff']).toHexString());
			}
		}