pro init_devices,colortable=colortable
  ;display = getenv('DISPLAY')

  ;if display eq '' then begin
  ;   set_plot,'z'
  ;   print,'Warning: No display!; Using Z buffer.'
  ;endif

  if n_elements(colortable) eq 0 then colortable =34

  old_dev = !d.name   ;  save current device name
  set_plot,'PS'       ;  change to PS so we can edit the font mapping
  loadct2,colortable
  device,/symbol,font_index=19  ;set font !19 to Symbol
  set_plot,'printer'
  loadct2,colortable
  set_plot,old_dev    ;  revert to old device

  if !d.name eq 'WIN' then begin
    device,decompose = 0
  endif

  if !d.name eq 'X' then begin
    ; device,pseudo_color=8  ;fixes color table problem for machines with 24-bit color
    device,decompose = 0
    if !version.os_name eq 'linux' then device,retain=2  ; Linux does not provide backing store by default
  endif

;  !p.font = -1
  loadct2,colortable

  ; black on white
  !p.background = !d.table_size-1
  !p.color=0

end
