source/colors.js
// Click-handler for the predefined styles list body

Click-handler for the predefined styles list body
Click - handler for the predefined styles list body
function onListBodyClick(e) {
    const li = e.target.closest('LI')
    if (li) {
      const div = li.querySelector('DIV')
      if (div) {
        const color = div.style.backgroundColor
        const m = /(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(color)
        if (Array.isArray(m) && m.length === 4) {
          updateColor(m[1], m[2], m[3])
          setSliders()
        }
      }
      setListHeader(li)
    }
  }
function onListBodyClick ( e ) { const li = e . target . closest ( 'LI' ) if ( li ) { const div = li . querySelector ( 'DIV' ) if ( div ) { const color = div . style . backgroundColor const m = / (\d+)\s*,\s*(\d+)\s*,\s*(\d+) / . exec ( color ) if ( Array . isArray ( m ) && m . length === 4 ) { updateColor ( m [ 1 ] , m [ 2 ] , m [ 3 ] ) setSliders ( ) } } setListHeader ( li ) } }
Click-handler for the predefined styles list body
Click - handler for the predefined styles list body
// Find the list item that was clicked
 // The list item's first DIV (if any) contains the item's color value
 // Extract the background-color inline style for the item's color
 // Color values are returned as a string, e.g. "rgb(128, 255, 255)"
 // Update the foreground or background color value, and preview pane
 // Set the color sliders and values
 // Put the selected color in the dropdown list header box
