Olá amigo td blz?
Olha, não achei API então coloquei a cuca pra funcionar para decompor a cor em RGB. Só q RGB é para 24 bits (16,7 milhões de cores) e tem cor q não vai pegar. Bom, fiz uma classe para poder obter a decomposição... olha ela ae:
************ CLASSE *********************
Private bVermelho As Byte
Private bVerde As Byte
Private bAzul As Byte
Private Property Let Vermelho(ByVal bRed As Byte)
bVermelho = bRed
End Property
Public Property Get Vermelho() As Byte
Vermelho = bVermelho
End Property
Private Property Let Verde(ByVal bGreen As Byte)
bVerde = bGreen
End Property
Public Property Get Verde() As Byte
Verde = bVerde
End Property
Private Property Let Azul(ByVal bBlue As Byte)
bAzul = bBlue
End Property
Public Property Get Azul() As Byte
Azul = bAzul
End Property
Public Function Cor() As Long
Cor = RGB(Vermelho, Verde, Azul)
End Function
Public Sub Decompor(ByVal valor As Long)
If valor >= 0 Then 'cor de 32bits
Azul = valor 65536
Verde = (valor Mod 65536) 256
Vermelho = (valor Mod 65536) Mod 256
Else
Azul = 0
Verde = 0
Vermelho = 0
End If
End Sub
************** FIM CLASSE **************************
Chamei a classe de ClaCor então para usar faça assim:
Private Sub CommandButton4_Click()
Dim cCor As ClaCor
Set cCor = New ClaCor
cCor.Decompor (&H80FF&)
Debug.Print cCor.Vermelho
Debug.Print cCor.Verde
Debug.Print cCor.Azul
End Sub
Vc vai passar a cor no método 'DECOMPOR' da classe igual ao exemplo acima... depois é só pegar os valores correspondentes para vermelho, verde e azul pelos seus atributos...
Tb há o método 'Cor' q retorna a cor desejada... igual ao RGB... vc passa o vermelho, azul e verde e obtém a cor q vc quer... só q tem q mudar de PRIVATE para PUBLIC nos "LET'S"
Bom, teste ae... qq coisa é só postar
at+
obs.: O SITE NÃO MOSTRA A BARRA INVERTIDA NESTAS OPERAÇÕES:
Azul = valor 65536
Verde = (valor Mod 65536) 256
Há uma barra INVERTIDA ENTRE 'VALOR' E '65536' na primeira equação e tb há uma entre '(VALOR MOD 65536)' e '256'
Barra invertida é O INVERSO DESTA => /
Esta barra invertida q uso é para retornar divisões inteiras e truncadas, sem resto.