Get hex value of clicked on color with jQuery

前端 未结 3 437
孤独总比滥情好
孤独总比滥情好 2021-01-07 00:37

I want to know how to make a color picker with jQuery that will allow you to click somewhere on the page and return the hex color value of the color that you clicked on.

3条回答
  •  我在风中等你
    2021-01-07 00:57

    Those plugins don't work by knowing the color of the pixel under the mouse; they work because the colors in the picker are laid out according to a mathematical formula, and by knowing that formula and where you clicked the mouse, the plugin can find out what color belongs there. JavaScript doesn't give you any way to get an image of the page or the "color under the cursor".

提交回复
热议问题