Interface PaletteSettings

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PaletteSettings
The colours a user chose for one overlay, as OverlayPalette.of(PaletteSettings) reads them: a built-in PaletteSettings.Scheme, and for PaletteSettings.Scheme.CUSTOM a colour per PaletteSettings.Slot that replaces Classic's.

Back it with the plugin's config. A scheme picker alone is a method reference, OverlayPalette.of(config::hudScheme) for a @ConfigItem returning PaletteSettings.Scheme; a custom scheme also overrides color(Slot) and returns the config's Color items (null keeps Classic's colour). Build the palette when the config changes or on the game tick and publish it with the overlay's snapshot; the render thread reads the snapshot only.

  • Method Details

    • scheme

      The chosen scheme.
      Returns:
      the scheme; null is Classic
    • color

      default Color color(PaletteSettings.Slot slot)
      The user's colour for one slot of a PaletteSettings.Scheme.CUSTOM scheme. Not read for the other schemes. The alpha is ignored: palette colours are opaque, and transparency comes from the overlay's opacity.
      Parameters:
      slot - the palette colour
      Returns:
      the colour, or null to keep Classic's