觉得默认的着色设置不是很清楚,甚至很难看,就网上找了找方法,想和谐他的着色配置,终于找到了。
方法如下:
修改wp-syntax/wp-syntax.php文件,在122行插入下面内容。
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | $geshi = new GeSHi($code, $language); $geshi->enable_keyword_links(false); do_action_ref_array('wp_syntax_init_geshi', array(&$geshi)); //*********************** $geshi->set_overall_style('color: #000000; font-family:"Consolas",monospace,"Courier New"'); //默认颜色 $geshi->set_brackets_style('color:#CCB;background-color:#F0F0F0', true); //括号颜色 $geshi->set_keyword_group_style(1, 'color: #9400D3;font-weight: bold;'); //第一组关键字 new public class $geshi->set_keyword_group_style(2, 'color: #DC143C;'); //第二组关键字 true $geshi->set_keyword_group_style(3, 'color: #436EEE;'); //第三组关键字 Object ThreadLocal $geshi->set_methods_style(1, 'color: #B8860B;'); //第一组方法名称 $geshi->set_comments_style(1, 'color: #777777;'); //第一组注释 $geshi->set_comments_style(2, 'color: #33CC66;'); //第二组注释 $geshi->set_comments_style('MULTI', 'color: #008B45;'); //多行注释 $geshi->set_strings_style('color: #00CD00;'); //字符串直接量 $geshi->set_strings_style('color: #00CD00;', false, 'HARD'); //字符串直接量(*) $geshi->set_regexps_style(0, 'color: #000088;'); //正则表达式 $geshi->set_numbers_style('color: #A52A2A;'); //数字 $geshi->set_symbols_style('color: #4A708B;'); //符号 $geshi->set_escape_characters_style('color: #99FF00;'); //转义字符 //*********************** //START LINE HIGHLIGHT SUPPORT $highlight = array(); if ( !empty($match[4]) ) … |
参考:http://lync.in/customizing-wp-syntax-code-styles/