class_docstr: A base class containing for the 2D browser.
  
  This class contains all backend-independent attributes and methods.
class_docstr_tok: ["A","base","class","containing","for","the","2D","browser",".","This","class","contains","all","backend-independent","attributes","and","methods","."]
docstr: Mark/unmark bad channels; `idx` is index of *visible* channels.
docstr_tok: ["Mark\/unmark","bad","channels",";","`","idx","`","is","index","of","*","visible","*","channels","."]
code: def _toggle_bad_channel(self, idx):
      """Mark/unmark bad channels; `idx` is index of *visible* channels."""
      pick = self.mne.picks[idx]
      ch_name = self.mne.ch_names[pick]
      # add/remove from bads list
      bads = self.mne.info["bads"]
      marked_bad = ch_name not in bads
      if marked_bad:
          bads.append(ch_name)
          color = self.mne.ch_color_bad
      else:
          while ch_name in bads:  # to make sure duplicates are removed
              bads.remove(ch_name)
          # Only mpl-backend has ch_colors
          if hasattr(self.mne, "ch_colors"):
              color = self.mne.ch_colors[idx]
          else:
              color = None
      self.mne.info["bads"] = bads
  
      self._update_projector()
  
      return color, pick, marked_bad
  
imports: import importlib
  from abc import ABC, abstractmethod
  from collections import OrderedDict
  from contextlib import contextmanager
  from copy import deepcopy
  from itertools import cycle
  import numpy
  from .._fiff.pick import _DATA_CH_TYPES_SPLIT
  from ..defaults import _handle_default
  from ..filter import _iir_filter, _overlap_add_filter
  from ..fixes import _compare_version
  from ..utils import _check_option, _get_stim_channel, _validate_type, get_config, logger, set_config, verbose
  from .backends._utils import VALID_BROWSE_BACKENDS
  from .utils import _get_color_list, _setup_plot_projector, _show_browser
label_desc: Use image node_id 6 for calling the BrowserBase obj's underlying member method code with example usage: obj._toggle_bad_channel(idx) and returns: color,  pick,  marked_bad