Object Model Reference : Classes : P : Palette : Methods : Palette.MatchColor |
Function MatchColor(Color As Color) As Long
Member of Palette
The MatchColor method finds the closest match for a color from the given palette.
The following VBA example creates red by using the CMYK color model and then converts the color to an RGB color. The MatchColor method then finds the closest match from the active palette and displays the name of that color.
Sub TestPalette() |
Dim pal As Palette |
Dim cColor As Color |
Dim i As Integer |
Set pal = ActivePalette |
Set cColor = CreateCMYKColor(0, 100, 100, 0) 'Red |
cColor.ConvertToRGB |
i = pal.MatchColor(cColor) |
MsgBox pal.Color(i).Name |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.