Previous Document Next Document

Object Model Reference : Classes : P : Palette : Methods : Palette.RemoveColor


Palette.RemoveColor

Sub RemoveColor(Index As Long)

Description

Member of Palette

The RemoveColor method removes the specified color from a color palette.

Parameter
Description
Index
Specifies the color by its index number

VBA example

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

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.