• The fastest way to implement a color picker (color eyedropper) in Chrome


    When it comes to the implementation method of the web page color picker (color eyedropper tool) in the front end, we usually think of doing it first.webpage Screenshot, then viaCanvasDraw a screenshot, at this time useCanvasThe provided API can parse out the color of each pixel of the image, and finally obtain themouse positioning, get […]

  • Real-time highlighting of stdout log logs


    Development and debuggingstdout logLogs are highlighted in real time Highlight In fact, it is to search for specific keywords and replace them with ANSI escape code Regular replacement,perl -pe ‘s/<pattern>;/<replacement>;/g’ egrepkeyword replacementegrep “fatal|error|warning|info|debug” -A10 -B10 –color=auto The way perl can specify different colors for different keywords, egrep custom color estimation is very troublesome. Cooperate with […]