Record Class ThemePalette

java.lang.Object
java.lang.Record
dev.myriadclient.api.ui.ThemePalette
Record Components:
background - the window background's base colour
foreground - text colour
selection - selection colour, the base of surfaces and the inactive border
accent - the accent colour
ansi - the 16 ANSI colours, indexed as terminals do (1 red, 2 green, 3 yellow, 4 blue, 5 magenta, 6 cyan); must hold at least 7
borderFrom - the active border's first gradient stop, or null to follow the accent
borderTo - the active border's second stop, or null to follow the secondary colour; it is also the secondary colour unless it's null or the accent's own, when magenta (ansi[5]) is
inactiveBorder - the inactive border, or null for a translucent selection colour
rounding - window rounding in Hyprland's pixels (halved into UI units), or null to leave it as it is

public record ThemePalette(int background, int foreground, int selection, int accent, int[] ansi, @Nullable Integer borderFrom, @Nullable Integer borderTo, @Nullable Integer inactiveBorder, @Nullable Integer rounding) extends Record
A terminal-style colour scheme (background, foreground, selection, accent and the 16 ANSI colours) and the mapping from it to every colour a Myriad theme has. Build themes from editor or terminal schemes without picking 20 colours by hand. Border and rounding values are optional. Colours are ARGB ints.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ThemePalette(int background, int foreground, int selection, int accent, int[] ansi, @Nullable Integer borderFrom, @Nullable Integer borderTo, @Nullable Integer inactiveBorder, @Nullable Integer rounding)
    Creates an instance of a ThemePalette record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the accent record component.
    int[]
    Returns the value of the ansi record component.
    int
    ansi(int i)
    ANSI colour i (0-15).
    void
    Writes the palette into a theme: the accent, secondary, borders, text, backgrounds, surfaces, menu tint, bar and the six palette colours, each derived from the scheme (backgrounds translucent, dim text between the foreground and background).
    int
    Returns the value of the background record component.
    @Nullable Integer
    Returns the value of the borderFrom record component.
    @Nullable Integer
    Returns the value of the borderTo record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the foreground record component.
    final int
    Returns a hash code value for this object.
    @Nullable Integer
    Returns the value of the inactiveBorder record component.
    of(int background, int foreground, int selection, int accent, int secondary, int red, int green, int yellow, int blue, int magenta, int cyan)
    A palette from the colours a theme preset usually names; the other ANSI slots use the foreground.
    @Nullable Integer
    Returns the value of the rounding record component.
    int
    Returns the value of the selection record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ThemePalette

      public ThemePalette(int background, int foreground, int selection, int accent, int[] ansi, @Nullable Integer borderFrom, @Nullable Integer borderTo, @Nullable Integer inactiveBorder, @Nullable Integer rounding)
      Creates an instance of a ThemePalette record class.
      Parameters:
      background - the value for the background record component
      foreground - the value for the foreground record component
      selection - the value for the selection record component
      accent - the value for the accent record component
      ansi - the value for the ansi record component
      borderFrom - the value for the borderFrom record component
      borderTo - the value for the borderTo record component
      inactiveBorder - the value for the inactiveBorder record component
      rounding - the value for the rounding record component
  • Method Details

    • ansi

      public int ansi(int i)
      ANSI colour i (0-15).
    • of

      public static ThemePalette of(int background, int foreground, int selection, int accent, int secondary, int red, int green, int yellow, int blue, int magenta, int cyan)
      A palette from the colours a theme preset usually names; the other ANSI slots use the foreground. secondary becomes the active border's second stop and, unless it matches the accent, the theme's secondary colour.
    • apply

      public void apply(ThemeSettings t)
      Writes the palette into a theme: the accent, secondary, borders, text, backgrounds, surfaces, menu tint, bar and the six palette colours, each derived from the scheme (backgrounds translucent, dim text between the foreground and background). Only colours (and rounding, if set) change. Call it from a Theme's apply function.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • background

      public int background()
      Returns the value of the background record component.
      Returns:
      the value of the background record component
    • foreground

      public int foreground()
      Returns the value of the foreground record component.
      Returns:
      the value of the foreground record component
    • selection

      public int selection()
      Returns the value of the selection record component.
      Returns:
      the value of the selection record component
    • accent

      public int accent()
      Returns the value of the accent record component.
      Returns:
      the value of the accent record component
    • ansi

      public int[] ansi()
      Returns the value of the ansi record component.
      Returns:
      the value of the ansi record component
    • borderFrom

      public @Nullable Integer borderFrom()
      Returns the value of the borderFrom record component.
      Returns:
      the value of the borderFrom record component
    • borderTo

      public @Nullable Integer borderTo()
      Returns the value of the borderTo record component.
      Returns:
      the value of the borderTo record component
    • inactiveBorder

      public @Nullable Integer inactiveBorder()
      Returns the value of the inactiveBorder record component.
      Returns:
      the value of the inactiveBorder record component
    • rounding

      public @Nullable Integer rounding()
      Returns the value of the rounding record component.
      Returns:
      the value of the rounding record component