   $('body').keyup ( event) ->
     switch event.which
       when K_H then $('#help_dialog').fadeToggle 'fast'
-      when K_0 then select_color_source 0
-      when K_1 then select_color_source 1
-      when K_2 then select_color_source 2
-      when K_3 then select_color_source 3
+      when K_0 then editor.choose_brush 0
+      when K_1 then editor.choose_brush 1
+      when K_2 then editor.choose_brush 2 if mode.color_mode is 'multi-color'
+      when K_3 then editor.choose_brush 3 if mode.color_mode is 'multi-color'
       when K_C then copy_from_index = selected_character_code
       when K_V then selected_character().copy_from  copy_from_index
       when K_S then localStorage["data"] = JSON.stringify( data )

# - Remember for each character and sprite whether it's intended for display as hi-res or multi-color

# - copy range of entities
# - bit limited, but remember changeable color for each entity and apply that color when painting on the macro
# - palette_dialog in its own class
# - when select char, changeable color should update


# FEATURES

    render_everything()
    dlg.fadeOut 'fast'

  # 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
        # In hi-res mode, div#3 relates to pixel_value:1 but in multi-color
        # mode, div#3 relates to pixel_value:3
        dlg.data 'pixel_value', $(div).data('pixel_value')
        dlg.fadeIn 'fast'

  # When multi-color mode is selected:
