Enum TerminalTheme

java.lang.Object
java.lang.Enum<TerminalTheme>
org.aesh.terminal.detect.TerminalTheme
All Implemented Interfaces:
Serializable, Comparable<TerminalTheme>

public enum TerminalTheme extends Enum<TerminalTheme>
Terminal background theme: dark, light, or unknown.
  • Enum Constant Details

  • Method Details

    • values

      public static TerminalTheme[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static TerminalTheme valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • isDark

      public boolean isDark()
    • isLight

      public boolean isLight()
    • fromRGB

      public static TerminalTheme fromRGB(int red, int green, int blue)
      Determine theme from RGB background color values. Uses the perceived luminance formula (ITU-R BT.601).
      Parameters:
      red - red component (0-255)
      green - green component (0-255)
      blue - blue component (0-255)
      Returns:
      LIGHT if luminance > 128, DARK otherwise
    • fromGrayscale

      public static TerminalTheme fromGrayscale(int gray)
      Determine theme from a grayscale value.
      Parameters:
      gray - grayscale value (0-255, where 0 is black and 255 is white)
      Returns:
      LIGHT if gray > 128, DARK otherwise