[点晴永久免费OA]【ASP】将HEX十六进制颜色转换为RGB后加深或减淡,然后再还原为HEX颜色函数
当前位置:点晴教程→点晴OA办公管理信息系统
→『 经验分享&问题答疑 』
'tmpHexColor-十六进制颜色,以#开头;tmpValue-正数减淡、负数加深,一般取60-80才会有明显的变化 function changeColorDeep(tmpHexColor, tmpValue) changeColorDeep=tmpHexColor if left(tmpHexColor &"CS",1)="#" then tmp_hexval = right(tmpHexColor,6) tmp_rgbval = CLng("&h" & tmp_hexval) tmp_r_RGB = (tmp_rgbval And &hff0000&)/65536+(tmpValue) tmp_g_RGB= (tmp_rgbval And &h00ff00&)/256+(tmpValue) tmp_b_RGB= (tmp_rgbval And &h0000ff&)+(tmpValue) if not len(tmp_r_RGB)=0 and not len(tmp_g_RGB)=0 and not len(tmp_b_RGB)=0 and isnumeric(tmp_r_RGB) and isnumeric(tmp_g_RGB) and isnumeric(tmp_b_RGB) then if cint(tmp_r_RGB)<0 then tmp_r_RGB=0 if cint(tmp_r_RGB)>255 then tmp_r_RGB=255 if cint(tmp_g_RGB)<0 then tmp_g_RGB=0 if cint(tmp_g_RGB)>255 then tmp_g_RGB=255 if cint(tmp_b_RGB)<0 then tmp_b_RGB=0 if cint(tmp_b_RGB)>255 then tmp_b_RGB=255 tmp_r_HEX=hex(tmp_r_RGB) tmp_g_HEX=hex(tmp_g_RGB) tmp_b_HEX=hex(tmp_b_RGB) if len(tmp_r_HEX)=1 then tmp_r_HEX="0" & tmp_r_HEX if len(tmp_g_HEX)=1 then tmp_g_HEX="0" & tmp_g_HEX if len(tmp_b_HEX)=1 then tmp_b_HEX="0" & tmp_b_HEX changeColorDeep="#" & tmp_r_HEX & tmp_g_HEX & tmp_b_HEX else changeColorDeep="#000000" end if end if end function 该文章在 2023/4/20 11:19:48 编辑过 |
关键字查询
相关文章
正在查询... |