Object Model Reference : Classes : P : Palette : Methods : Palette.RemoveColor |
Sub RemoveColor(Index As Long)
Member of Palette
The RemoveColor method removes the specified color from a color palette.
The following VBA example duplicates the default palette and then removes all dark colors (the colors that have a lightness less than 50%) from it.
Sub Test() |
Dim c As New Color |
Dim src As Palette, dest As Palette |
Dim idx As Long |
Set src = ActivePalette |
Set dest = Palettes.Create("Bright Colors") |
For Each c In src.Colors |
dest.AddColor c |
Next c |
For idx = dest.ColorCount To 1 Step -1 |
c.CopyAssign dest.Color(idx) |
c.ConvertToHLS |
If c.HLSLightness < 128 Then dest.RemoveColor idx |
Next idx |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.