Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -133,6 +134,15 @@ void define(final NamedWidgetColor color)
colors.put(color.getName(), color);
}

/** Define a name to point to a named color
* @param name Name of the color
* @param color Named color
*/
void define(String name, final NamedWidgetColor color)
{
colors.put(name, color);
}

/** Get named color
* @param name Name of the color
* @return Named color, if known
Expand All @@ -156,7 +166,7 @@ public NamedWidgetColor resolve(final NamedWidgetColor color)
*/
public Collection<NamedWidgetColor> getColors()
{
return Collections.unmodifiableCollection(colors.values());
return Collections.unmodifiableSet(new HashSet<>(colors.values()));
}

@Override
Expand All @@ -168,7 +178,7 @@ protected void parse ( final String name, final String value ) throws Exception

NamedWidgetColor namedColor = optionalColor.get();

define(new NamedWidgetColor(name, namedColor.getRed(), namedColor.getGreen(), namedColor.getBlue(), namedColor.getAlpha()));
define(name, namedColor);

} else {

Expand Down