PGSystemTester

RGB Color Conversion

Jul 23rd, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Convert Color Index to RGB
  2. 'Example: =getRGB(48,"R")
  3. Function getRGB(C_Index As Long, LetterTYPE As String) As Integer
  4. Dim R As Integer, G As Integer, B As Integer
  5.  
  6.         R = C_Index Mod 256
  7.         G = C_Index \ 256 Mod 256
  8.         B = C_Index \ 65536 Mod 256
  9.  
  10.         If UCase(LetterTYPE) = "R" Then
  11.            getRGB = R
  12.         ElseIf UCase(LetterTYPE) = "G" Then
  13.             getRGB = G
  14.         ElseIf UCase(LetterTYPE) = "B" Then
  15.             getRGB = B
  16.         End If
  17. End Function
Add Comment
Please, Sign In to add comment