[點(diǎn)晴永久免費(fèi)OA]【ASP】將HEX十六進(jìn)制顏色轉(zhuǎn)換為RGB后加深或減淡,然后再還原為HEX顏色函數(shù)
'tmpHexColor-十六進(jìn)制顏色,以#開(kāi)頭;tmpValue-正數(shù)減淡、負(fù)數(shù)加深,一般取60-80才會(huì)有明顯的變化 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 編輯過(guò) |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |