Skip to content

CSSTUDIO-3196 Change the semantics of colors defined to be equal to other colors #3376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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