Class ColorItem


  • public class ColorItem
    extends SearchableItem
    Represents a track color label. This is a specialized SearchableItem, since in addition to a specific color, it has an ID and label that can be used as a way to select tracks in a dynamic playlist request, and on which playlists can be sorted. A simple immutable value class.
    Author:
    James Elliott
    • Field Detail

      • color

        public final Color color
        The color that is represented by this item.
      • colorName

        public final String colorName
        The name of the color represented by this item, for textual display.
    • Constructor Detail

      • ColorItem

        public ColorItem​(int id,
                         String label)
        Constructor simply sets the immutable value fields, looking up the color and name associated with the id.
        Parameters:
        id - the database ID associated with this item, for searches
        label - the text label used to show this item to the user
    • Method Detail

      • isNoColor

        public static boolean isNoColor​(Color color)
        Checks whether a color value corresponds to the "No Color" choice in rekordbox. This is implemented via transparency; the no-color choice is fully transparent.
        Parameters:
        color - a color to be examined
        Returns:
        true if the color represents the lack of a color assignment
      • colorForId

        public static Color colorForId​(int colorId)
        Returns the color represented by a color label assigned to a track in rekordbox. This is also used in the user interface color tint settings that can be set up for an exported media library (and returned in the MediaDetails response). If no color has been assigned, a fully-transparent black is returned, which can be tested for
        Parameters:
        colorId - the id of the color label assigned to a track or the col value in the MediaDetails
        Returns:
        the color that should be displayed (or which the UI should be tinted with)
      • colorNameForId

        public static String colorNameForId​(int colorId)
        Returns the name of the color represented by a color label assigned to a track in rekordbox. This is also used in the user interface color tint settings that can be set up for an exported media library (and returned in the MediaDetails response).
        Parameters:
        colorId - the id of the color label assigned to a track or the col value in the MediaDetails
        Returns:
        the color that should be displayed (or which the UI should be tinted with)