2019-02-28 18:00:18 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Player Analytics (Plan).
|
|
|
|
*
|
|
|
|
* Plan is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License v3 as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Plan is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
package com.djrapitops.plan.extension.icon;
|
|
|
|
|
2019-03-23 12:06:31 +01:00
|
|
|
import java.util.Optional;
|
|
|
|
|
2019-02-28 18:00:18 +01:00
|
|
|
/**
|
|
|
|
* Enum to determine what color to use for some element.
|
|
|
|
*
|
2021-02-13 14:16:03 +01:00
|
|
|
* @author AuroraLS3
|
2019-02-28 18:00:18 +01:00
|
|
|
*/
|
|
|
|
public enum Color {
|
|
|
|
|
|
|
|
RED,
|
|
|
|
PINK,
|
|
|
|
PURPLE,
|
|
|
|
DEEP_PURPLE,
|
|
|
|
INDIGO,
|
|
|
|
BLUE,
|
|
|
|
LIGHT_BLUE,
|
|
|
|
CYAN,
|
|
|
|
TEAL,
|
|
|
|
GREEN,
|
|
|
|
LIGHT_GREEN,
|
|
|
|
LIME,
|
|
|
|
YELLOW,
|
|
|
|
AMBER,
|
|
|
|
ORANGE,
|
|
|
|
DEEP_ORANGE,
|
|
|
|
BROWN,
|
|
|
|
GREY,
|
|
|
|
BLUE_GREY,
|
|
|
|
BLACK,
|
2019-03-23 12:06:31 +01:00
|
|
|
NONE;
|
2019-02-28 18:00:18 +01:00
|
|
|
|
2024-01-06 16:59:29 +01:00
|
|
|
/**
|
|
|
|
* Get a color by the enum name without exception.
|
|
|
|
*
|
|
|
|
* @param name Color#name()
|
|
|
|
* @return Optional if the color is found by that name, empty if not found.
|
|
|
|
*/
|
2019-03-23 12:06:31 +01:00
|
|
|
public static Optional<Color> getByName(String name) {
|
2019-04-14 09:31:30 +02:00
|
|
|
if (name == null) {
|
|
|
|
return Optional.empty();
|
|
|
|
}
|
2019-03-23 12:06:31 +01:00
|
|
|
try {
|
|
|
|
return Optional.of(valueOf(name));
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
return Optional.empty();
|
|
|
|
}
|
2024-01-06 16:59:29 +01:00
|
|
|
}
|
|
|
|
}
|