Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias hex {
- if ($isid) {
- var %r = $1,%g = $2,%b = $3
- if ($len(%r) == 1) { %r = 0 $+ %r }
- if ($len(%g) == 1) { %g = 0 $+ %g }
- if ($len(%b) == 1) { %b = 0 $+ %b }
- var %i 1
- while (%i <= 3) {
- var %calc = $calc($iif(%i == 1,%r,$iif(%i == 2,%g,%b)) / 16)
- if ($len($iif(%i == 1,%r,$iif(%i == 2,%g,%b)))) { var %remamount = - $+ $calc($len($iif(%i == 1,%r,$iif(%i == 2,%g,%b))) -1) }
- var %return = %return $+ $converthex($int(%calc),$int(%calc)) $+ $converthex($int(%calc),$int($calc($right(%calc,%remamount) *16)))
- inc %i
- }
- return $chr(35) $+ %return
- }
- }
- alias converthex {
- if ($isid) {
- var %even = 0,2,4,6,8,0,10,12,14
- var %odd = 1,3,5,7,9,11,13,15
- if ($istok(%even,$1,44)) { return $mid(0123456789ABCDEF,$calc($2 +1),1) }
- if ($istok(%odd,$1,44)) { return $mid(0123456789ABCDEF,$calc($2 +1),1) }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement