code: function prepareEditorForProvider(hostEditor, pos) {
          var colorRegEx, cursorLine, match, sel, start, end, endPos, marker;
  
          sel = hostEditor.getSelection();
          if (sel.start.line !== sel.end.line) {
              return null;
          }
  
          colorRegEx = new RegExp(ColorUtils.COLOR_REGEX);
          cursorLine = hostEditor.document.getLine(pos.line);
  
          // Loop through each match of colorRegEx and stop when the one that contains pos is found.
          do {
              match = colorRegEx.exec(cursorLine);
              if (match) {
                  start = match.index;
                  end = start + match[0].length;
              }
          } while (match && (pos.ch < start || pos.ch > end));
  
          if (!match) {
              return null;
          }
  
          // Adjust pos to the beginning of the match so that the inline editor won't get
          // dismissed while we're updating the color with the new values from user's inline editing.
          pos.ch = start;
          endPos = {line: pos.line, ch: end};
  
          marker = hostEditor._codeMirror.markText(pos, endPos);
          hostEditor.setSelection(pos, endPos);
  
          return {
              color: match[0],
              marker: marker
          };
      }
docs: Prepare hostEditor for an InlineColorEditor at pos if possible. Return
  editor context if so; otherwise null.
  
  @param {Editor} hostEditor
  @param {{line:Number, ch:Number}} pos
  @return {?{color:String, marker:TextMarker}}