张卓
2022-09-20 5aead44ba1be31db948dfd8362c2bfcbedbbce29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.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;
        }
    })()`;
}
.freakMixin();