InvertColor

Converts color into its negative value, as in "e4f15a" into "1C0FA6"

Function InvertColor(ColorHex)
 ' Needs HexToDec and DecToHex
 ' Converts "e4f15a" to "1C0FA6"
 ' Needs DecToHex and HexToDec below
 ' If ColorHex = "" Then Exit function
 C1       = ColorHex
 If Len(ColorHex) = 3 Then
  C1      = Left(C1,1) & Left(C1,1) & Mid(C1,2,1) & Mid(C1,2,1) & Right(C1,1) & Right(C1,1)
 End If
 NC1       = Right(DecToHex(abs(256 - clng(HexToDec(Left(C1,2))))),2)
 NC2       = Right(DecToHex(abs(256 - clng(HexToDec(Mid(C1,3,2))))),2)
 NC3       = Right(DecToHex(abs(256 - clng(HexToDec(Right(C1,2))))),2)
 InvertColor    = NC1 & NC2 & NC3
End Function

ColorHex

Views 689 Downloads 231

'HexToDec', 'DecToHex', 'colors', 'convert', 'decimal', 'hexadecimal'

ANmarAmdeen
326
Graphics Classic ASP
Revisions

v1.0