# class KColorCollection

###

Module | kdeui
Namespace |
Class | KColorCollection
Inherits |

Class for handling color collections ("palettes").

This class makes it easy to handle color collections, sometimes referred to as "palettes". This class can read and write collections from and to a file.

This class uses the "GIMP" palette file format.

Author Waldo Bastian (bastian@kde.org)

### enums

- Editable { Yes, No, Ask }

enum details

### methods

- KColorCollection (name)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  name | QString | QString()

  KColorCollection constructor. Creates a KColorCollection from a file the filename is derived from the name.

  name - The name of collection as returned by installedCollections()

- KColorCollection (a0)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  a0 | KColorCollection |

  KColorCollection copy constructor.

- KColorCollection (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QString | QString()

- addColor (newColor, newColorName)

  returns int

  Argument | Type | Default
  --- | --- | ---
  newColor | QColor |
  newColorName | QString | QString()

  Add a color.

  newColor - The color to add.

  newColorName - The name of the color, null to remove the name. Returns The index of the added color.

- changeColor (index, newColor, newColorName)

  returns int

  Argument | Type | Default
  --- | --- | ---
  index | int |
  newColor | QColor |
  newColorName | QString | QString()

  Change a color.

  index - Index of the color to change

  newColor - The new color.

  newColorName - The new color name, null to remove the name. Returns The index of the new color or -1 if the color couldn't be changed.

- changeColor (oldColor, newColor, newColorName)

  returns int

  Argument | Type | Default
  --- | --- | ---
  oldColor | QColor |
  newColor | QColor |
  newColorName | QString | QString()

  Change a color.

  oldColor - The original color

  newColor - The new color.

  newColorName - The new color name, null to remove the name. Returns The index of the new color or -1 if the color couldn't be changed.

- color (index)

  returns QColor

  Argument | Type | Default
  --- | --- | ---
  index | int |

  Find color by index.

  index - the index of the desired color Returns The index -th color of the collection, null if not found.

- count ( )

  returns int

  Return the number of colors in the collection. Returns the number of colors

- description ( )

  returns QString

  Get the description of the collection. Returns the description of the collection.

- editable ( )

  returns KColorCollection.Editable

  Returns whether the collection may be edited. Returns the state of the collection

- findColor (color)

  returns int

  Argument | Type | Default
  --- | --- | ---
  color | QColor |

  Find index by color.

  color - the color to find Returns The index of the color in the collection or -1 if the color is not found.

- installedCollections ( )

  returns QStringList
  static

  Query which KDE color collections are installed.

  Returns A list with installed color collection names.

- name ( )

  returns QString

  Get the name of the collection. Returns the name of the collection

- name (index)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  index | int |

  Find color name by index.

  index - the index of the color Returns The name of the index -th color. Note that not all collections have named the colors. Null is returned if the color does not exist or has no name.

- name (color)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  color | QColor |

  Find color name by color. Returns The name of color according to this collection. Note that not all collections have named the colors. Note also that each collection can give the same color a different name.

- save ( )

  returns bool

  Save the collection

  Returns 'true' if successful

- setDescription (desc)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  desc | QString |

  Set the description of the collection.

  desc - the new description

- setEditable (editable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  editable | KColorCollection.Editable |

  Change whether the collection may be edited.

  editable - the state of the collection

- setName (name)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  name | QString |

  Set the name of the collection.

  name - the name of the collection

### enums - detail

- Editable { Yes, No, Ask }

  Used to specify whether a collection may be edited.

  See also editable()

  See also setEditable()

  | Yes | - | - |
  | No | - | - |
  | Ask | - | - |