.freakMixin() {
  @functions: ~`(function() {
    function toColorList(list) {
      list = list.slice(1, list.length - 1).split(',');
      var ret = [];
      for (var i = 0, c = list.length; i < c; i++) {
          ret.push(list[i].trim().split(' '));
      }
      return ret;
    }

    var catchColors;
    function _initColor(list) {
      if (!catchColors) catchColors = toColorList(list);
    }

    this.getColor = function(list, name, position) {
      _initColor(list);
      var ret = '';
      for (var i = 0, c = catchColors.length; i < c; i++) {
        if (catchColors[i][0] === name) {
          ret = catchColors[i][position - 1];
          break;
        }
      }
      return ret;
    }

    this.genComment = function(value, ...comments) {
      return '/* AUTOGENERATE: ' + comments.join('|SPLIT|').replace(/(\{0\})/g, '"' + value + '"') + '*/';
    }

    this.genCommentColor = function(color, ...comments) {
      var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.substring(1) + '/fff.png&text=+)';
      return '/* AUTOGENERATE: ' + comments.map(c => c + imgColor).join('|SPLIT|').replace(/(\{0\})/g, '"' + color + '"') + '*/';
    }

    this.genCommentTypeColor = function(type, color) {
      var comments = [];
      switch (type) {
        case 'text':
          comments = ['Set the text color to {0}', '设置文本颜色为 {0}'];
          break;
        case 'background':
          comments = ['Set the background light color to {0}', '设置背景颜色为 {0}'];
          break;
        case 'hoverBackground':
          comments = ['Set the hover background color to {0}', '设置悬停时背景颜色为 {0}'];
          break;
      }
      if (comments.length === 0) return '';
      var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.substring(1) + '/fff.png&text=+)';
      return '/* AUTOGENERATE: ' + comments.map(c => c + imgColor).join('|SPLIT|').replace(/(\{0\})/g, '"' + color + '"') + '*/';
    }
  })()`;
}
.freakMixin();
