接上篇:代码发芽网 - 代码高亮 - 添加了22个流行的vim配色主题
继续增强内功。
代码发芽网 ( http://www.fayaa.com/code/ )简介:
1. 无需插件支持blog代码高亮
2. 近百种编程语言,30多个流行的高亮主题
3. 稳定支持各种blog、论坛、邮箱
最新更新 :
1. 界面更新 :一改原来的混乱方案,采用更加清晰的表格、布局来帮助你更高效的完成代码高亮、收藏、评论等操作
2. 支持论坛 :论坛中一般为了安全考虑采用BBcode,最近更新的功能(显示代码页点击”复制BBcode”)对Discuz!等论坛 有非常棒的支持。
3. 点击复制 :有不少网友试用的是HTML简单编辑器,提出需要简单的复制HTML代码的功能,现在提供的只需要点击一个链接即可完成。同样也提供了对BBcode和源代码的复制功能。
4. 搜索功能 :提供了搜索所有代码标题的功能
5. 一些bug fix和边角功能的更新,使得生成的代码体积下降了50%! (据我实验,虽不算最优,可改进空间已经很小了)
还是贴两个例子看看效果吧 :
来个desert主题的:
01
//转到固定长度的十六进制字符串,不够则补0
02
function
zero_fill_hex
(
num
,
digits
)
{
03
var
s
=
num
.
toString
(
16
);
04
while
(
s
.
length
<
digits
)
05
s
=
"0"
+
s
;
06
return
s
;
07
}
08
09
//妈的,怎么都没搜到怎么用javascript找出一个背景色的数值,只好自己解析
10
function
rgb2hex
(
rgb
)
{
11
//nnd, Firefox / IE not the same, fxck
12
if
(
rgb
.
charAt
(
0
)
==
'#'
)
13
return
rgb
;
14
var
n
=
Number
(
rgb
);
15
var
ds
=
rgb
.
split
(
/\D+/
);
16
var
decimal
=
Number
(
ds
[
1
])
*
65536
+
Number
(
ds
[
2
])
*
256
+
Number
(
ds
[
3
]);
17
return
"#"
+
zero_fill_hex
(
decimal
,
6
);
18
}
来个浅色背景的主题:
a {
color
:
#0000CC ;
text-decoration
:
none ; }
a
:visited {
color
:
#0000CC ;
text-decoration
:
none ; }
a
:hover {
text-decoration
:
underline ; }
a
img {
padding
:
0px ;
margin
:
0px
auto ;
border-style
:
none ; }
img {
padding
:
0px ;
margin
:
0px
auto ;
border-style
:
none ; }
input
:focus
,
select
:focus
,
textarea
:focus {
border
:
1px
solid
#ff00ff ;
background
:
#FFFFBB ;
}
thead {
background
:
#ccff99 ; }
input
,
textarea {
border
:
1px
solid
#c0c0c0 ; }
ul {
padding
:
0px ;
margin
:
0px
auto ;
list-style
:
none ; }
.submit {
background
:
#ccff99 ;
font-size
:
x-large ; }
.error_text
,
.errorlist {
color
:
#F80098 ; }
.error {
border
:
3px
solid
red ; }
.clear {
clear
:
both ; }
body {
font-family
:
"Verdana"
,
"Tahoma"
,
"Georgia"
,
"Arial"
,
"微软雅黑"
,
"宋体" ;
padding
:
0px ;
margin
:
0px
auto ;
}
table
,
ul {
font-family
:
"微软雅黑"
,
"宋体" ; }
form {
padding-left
:
3px ; }
最后来个卡通点儿的字体:
#from http:
//bbs.bccn.net/thread-224663-1-1.html
int
GCD
(
int
a
,
int
b
)
{
if
(
b
==
0
)
return
a
;
else
return
GCD
(
b
,
a
%
b
);
}
int
LCM
(
int
a
,
int
b
)
{
return
a
*
b
/
GCD
(
a
,
b
);
}