test_class.file: api/src/test/java/net/kyori/adventure/text/format/NamedTextColorTest.java
test_class.identifier: NamedTextColorTest
test_case.body: @SuppressWarnings("ConstantConditions") // intentionally passing 'null'
    @Test
    void testNullRejected() {
      assertThrows(NullPointerException.class, () -> NamedTextColor.nearestTo(null), "color");
    }
test_case.class_method_signature: NamedTextColorTest.testNullRejected()
test_case.full_signature: @SuppressWarnings("ConstantConditions") // intentionally passing 'null' @Test void testNullRejected()
test_case.identifier: testNullRejected
test_case.invocations: assertThrows nearestTo
test_case.modifiers: @SuppressWarnings("ConstantConditions") // intentionally passing 'null' @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNullRejected()
focal_class.declarator: BLACK_VALUE = 0x000000
focal_class.modifier: private static final
focal_class.original_string: private static final int BLACK_VALUE = 0x000000;
focal_class.type: int
focal_class.var_name: BLACK_VALUE
focal_class.declarator: DARK_BLUE_VALUE = 0x0000aa
focal_class.modifier: private static final
focal_class.original_string: private static final int DARK_BLUE_VALUE = 0x0000aa;
focal_class.type: int
focal_class.var_name: DARK_BLUE_VALUE
focal_class.declarator: DARK_GREEN_VALUE = 0x00aa00
focal_class.modifier: private static final
focal_class.original_string: private static final int DARK_GREEN_VALUE = 0x00aa00;
focal_class.type: int
focal_class.var_name: DARK_GREEN_VALUE
focal_class.declarator: DARK_AQUA_VALUE = 0x00aaaa
focal_class.modifier: private static final
focal_class.original_string: private static final int DARK_AQUA_VALUE = 0x00aaaa;
focal_class.type: int
focal_class.var_name: DARK_AQUA_VALUE
focal_class.declarator: DARK_RED_VALUE = 0xaa0000
focal_class.modifier: private static final
focal_class.original_string: private static final int DARK_RED_VALUE = 0xaa0000;
focal_class.type: int
focal_class.var_name: DARK_RED_VALUE
focal_class.declarator: DARK_PURPLE_VALUE = 0xaa00aa
focal_class.modifier: private static final
focal_class.original_string: private static final int DARK_PURPLE_VALUE = 0xaa00aa;
focal_class.type: int
focal_class.var_name: DARK_PURPLE_VALUE
focal_class.declarator: GOLD_VALUE = 0xffaa00
focal_class.modifier: private static final
focal_class.original_string: private static final int GOLD_VALUE = 0xffaa00;
focal_class.type: int
focal_class.var_name: GOLD_VALUE
focal_class.declarator: GRAY_VALUE = 0xaaaaaa
focal_class.modifier: private static final
focal_class.original_string: private static final int GRAY_VALUE = 0xaaaaaa;
focal_class.type: int
focal_class.var_name: GRAY_VALUE
focal_class.declarator: DARK_GRAY_VALUE = 0x555555
focal_class.modifier: private static final
focal_class.original_string: private static final int DARK_GRAY_VALUE = 0x555555;
focal_class.type: int
focal_class.var_name: DARK_GRAY_VALUE
focal_class.declarator: BLUE_VALUE = 0x5555ff
focal_class.modifier: private static final
focal_class.original_string: private static final int BLUE_VALUE = 0x5555ff;
focal_class.type: int
focal_class.var_name: BLUE_VALUE
focal_class.declarator: GREEN_VALUE = 0x55ff55
focal_class.modifier: private static final
focal_class.original_string: private static final int GREEN_VALUE = 0x55ff55;
focal_class.type: int
focal_class.var_name: GREEN_VALUE
focal_class.declarator: AQUA_VALUE = 0x55ffff
focal_class.modifier: private static final
focal_class.original_string: private static final int AQUA_VALUE = 0x55ffff;
focal_class.type: int
focal_class.var_name: AQUA_VALUE
focal_class.declarator: RED_VALUE = 0xff5555
focal_class.modifier: private static final
focal_class.original_string: private static final int RED_VALUE = 0xff5555;
focal_class.type: int
focal_class.var_name: RED_VALUE
focal_class.declarator: LIGHT_PURPLE_VALUE = 0xff55ff
focal_class.modifier: private static final
focal_class.original_string: private static final int LIGHT_PURPLE_VALUE = 0xff55ff;
focal_class.type: int
focal_class.var_name: LIGHT_PURPLE_VALUE
focal_class.declarator: YELLOW_VALUE = 0xffff55
focal_class.modifier: private static final
focal_class.original_string: private static final int YELLOW_VALUE = 0xffff55;
focal_class.type: int
focal_class.var_name: YELLOW_VALUE
focal_class.declarator: WHITE_VALUE = 0xffffff
focal_class.modifier: private static final
focal_class.original_string: private static final int WHITE_VALUE = 0xffffff;
focal_class.type: int
focal_class.var_name: WHITE_VALUE
focal_class.declarator: BLACK = new NamedTextColor("black", BLACK_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor BLACK = new NamedTextColor("black", BLACK_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: BLACK
focal_class.declarator: DARK_BLUE = new NamedTextColor("dark_blue", DARK_BLUE_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor DARK_BLUE = new NamedTextColor("dark_blue", DARK_BLUE_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: DARK_BLUE
focal_class.declarator: DARK_GREEN = new NamedTextColor("dark_green", DARK_GREEN_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor DARK_GREEN = new NamedTextColor("dark_green", DARK_GREEN_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: DARK_GREEN
focal_class.declarator: DARK_AQUA = new NamedTextColor("dark_aqua", DARK_AQUA_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor DARK_AQUA = new NamedTextColor("dark_aqua", DARK_AQUA_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: DARK_AQUA
focal_class.declarator: DARK_RED = new NamedTextColor("dark_red", DARK_RED_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor DARK_RED = new NamedTextColor("dark_red", DARK_RED_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: DARK_RED
focal_class.declarator: DARK_PURPLE = new NamedTextColor("dark_purple", DARK_PURPLE_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor DARK_PURPLE = new NamedTextColor("dark_purple", DARK_PURPLE_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: DARK_PURPLE
focal_class.declarator: GOLD = new NamedTextColor("gold", GOLD_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor GOLD = new NamedTextColor("gold", GOLD_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: GOLD
focal_class.declarator: GRAY = new NamedTextColor("gray", GRAY_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor GRAY = new NamedTextColor("gray", GRAY_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: GRAY
focal_class.declarator: DARK_GRAY = new NamedTextColor("dark_gray", DARK_GRAY_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor DARK_GRAY = new NamedTextColor("dark_gray", DARK_GRAY_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: DARK_GRAY
focal_class.declarator: BLUE = new NamedTextColor("blue", BLUE_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor BLUE = new NamedTextColor("blue", BLUE_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: BLUE
focal_class.declarator: GREEN = new NamedTextColor("green", GREEN_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor GREEN = new NamedTextColor("green", GREEN_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: GREEN
focal_class.declarator: AQUA = new NamedTextColor("aqua", AQUA_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor AQUA = new NamedTextColor("aqua", AQUA_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: AQUA
focal_class.declarator: RED = new NamedTextColor("red", RED_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor RED = new NamedTextColor("red", RED_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: RED
focal_class.declarator: LIGHT_PURPLE = new NamedTextColor("light_purple", LIGHT_PURPLE_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor LIGHT_PURPLE = new NamedTextColor("light_purple", LIGHT_PURPLE_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: LIGHT_PURPLE
focal_class.declarator: YELLOW = new NamedTextColor("yellow", YELLOW_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor YELLOW = new NamedTextColor("yellow", YELLOW_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: YELLOW
focal_class.declarator: WHITE = new NamedTextColor("white", WHITE_VALUE)
focal_class.modifier: public static final
focal_class.original_string: public static final NamedTextColor WHITE = new NamedTextColor("white", WHITE_VALUE);
focal_class.type: NamedTextColor
focal_class.var_name: WHITE
focal_class.declarator: VALUES = Collections.unmodifiableList(Arrays.asList(BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE, YELLOW, WHITE))
focal_class.modifier: private static final
focal_class.original_string: private static final List<NamedTextColor> VALUES = Collections.unmodifiableList(Arrays.asList(BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE, YELLOW, WHITE));
focal_class.type: List<NamedTextColor>
focal_class.var_name: VALUES
focal_class.declarator: NAMES = Index.create(constant -> constant.name, VALUES)
focal_class.modifier: public static final
focal_class.original_string: public static final Index<String, NamedTextColor> NAMES = Index.create(constant -> constant.name, VALUES);
focal_class.type: Index<String, NamedTextColor>
focal_class.var_name: NAMES
focal_class.declarator: name
focal_class.modifier: private final
focal_class.original_string: private final String name;
focal_class.type: String
focal_class.var_name: name
focal_class.declarator: value
focal_class.modifier: private final
focal_class.original_string: private final int value;
focal_class.type: int
focal_class.var_name: value
focal_class.file: api/src/main/java/net/kyori/adventure/text/format/NamedTextColor.java
focal_class.identifier: NamedTextColor
focal_class.interfaces: implements TextColor
focal_class.class_method_signature: NamedTextColor.ofExact(final int value)
focal_class.full_signature: public static @Nullable NamedTextColor ofExact(final int value)
focal_class.identifier: ofExact
focal_class.modifiers: public static @Nullable
focal_class.parameters: (final int value)
focal_class.return: NamedTextColor
focal_class.signature: NamedTextColor ofExact(final int value)
focal_class.class_method_signature: NamedTextColor.nearestTo(final @NonNull TextColor any)
focal_class.full_signature: public static @NonNull NamedTextColor nearestTo(final @NonNull TextColor any)
focal_class.identifier: nearestTo
focal_class.modifiers: public static @NonNull
focal_class.parameters: (final @NonNull TextColor any)
focal_class.return: NamedTextColor
focal_class.signature: NamedTextColor nearestTo(final @NonNull TextColor any)
focal_class.class_method_signature: NamedTextColor.distanceSquared(final @NonNull TextColor self, final @NonNull TextColor other)
focal_class.full_signature: private static int distanceSquared(final @NonNull TextColor self, final @NonNull TextColor other)
focal_class.identifier: distanceSquared
focal_class.modifiers: private static
focal_class.parameters: (final @NonNull TextColor self, final @NonNull TextColor other)
focal_class.return: int
focal_class.signature: int distanceSquared(final @NonNull TextColor self, final @NonNull TextColor other)
focal_class.class_method_signature: NamedTextColor.NamedTextColor(final String name, final int value)
focal_class.full_signature: private  NamedTextColor(final String name, final int value)
focal_class.identifier: NamedTextColor
focal_class.modifiers: private
focal_class.parameters: (final String name, final int value)
focal_class.signature:  NamedTextColor(final String name, final int value)
focal_class.class_method_signature: NamedTextColor.value()
focal_class.full_signature: @Override public int value()
focal_class.identifier: value
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int value()
focal_class.class_method_signature: NamedTextColor.toString()
focal_class.full_signature: @Override public @NonNull String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public @NonNull
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_method.body: public static @NonNull NamedTextColor nearestTo(final @NonNull TextColor any) {
      if(any instanceof NamedTextColor) {
        return (NamedTextColor) any;
      }
  
      requireNonNull(any, "color");
  
      // TODO: This tends to match greys more than it should (rgb averages and all that)
      int matchedDistance = Integer.MAX_VALUE;
      NamedTextColor match = VALUES.get(0);
      for(int i = 0, length = VALUES.size(); i < length; i++) {
        final NamedTextColor potential = VALUES.get(i);
        final int distance = distanceSquared(any, potential);
        if(distance < matchedDistance) {
          match = potential;
          matchedDistance = distance;
        }
        if(distance == 0) {
          break; // same colour! whoo!
        }
      }
      return match;
    }
focal_method.class_method_signature: NamedTextColor.nearestTo(final @NonNull TextColor any)
focal_method.full_signature: public static @NonNull NamedTextColor nearestTo(final @NonNull TextColor any)
focal_method.identifier: nearestTo
focal_method.invocations: requireNonNull get size get distanceSquared
focal_method.modifiers: public static @NonNull
focal_method.parameters: (final @NonNull TextColor any)
focal_method.return: NamedTextColor
focal_method.signature: NamedTextColor nearestTo(final @NonNull TextColor any)