     switch mode.color_mode
       when 'hi-res' then $('.multi-color').fadeOut 'fast'
       when 'multi-color' then $('.multi-color').fadeIn 'fast'
-    # Assign pixel values to each color source
+    # In multi-color mode, #color_sources >div#3 relates to pixel_value:3 but
+    # in hi-res mode, div#3 relates to pixel_value:1
+    # Attach the pixel_value to each color source
     $('#color_sources >div').each ( i, div ) ->
       $(div).data 'pixel_value', if mode.color_mode is 'multi-color' or i < 3 then i else 1
     @render()

        $(td).css 'background-color', Color::for_pixel_value( selected_character().pixel_at  row, column ).hex
    $('#color_sources >div:visible').each ( pixel_value, div ) ->
      $(div).css 'background-color', Color::for_pixel_value( pixel_value).hex




    @build()
    # When the page first loads, the color on the brush should be evident
    @choose_brush 1 # @brush remembers whether to paint with foreground or background pixels
    # When a color source is selected, the brush should be dipped in to that color
    $('#color_sources >div').each ( i, div ) ->
      $(div).click () ->
        # If the source clicked is already selected then choose the color from
        # the palette
        if editor.brush isnt i
          editor.choose_brush  i
        else
          dlg = $ '#palette_dialog'
          # Tell the palette which color source it's manipulating
          dlg.data 'pixel_value', $(div).data('pixel_value')
          dlg.fadeIn 'fast'

  build: ->
    # The number of rows and columns change with the mode:
