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

    • DARK

      public static final TerminalTheme DARK
      Dark background theme.
    • LIGHT

      public static final TerminalTheme LIGHT
      Light background theme.
    • UNKNOWN

      public static final TerminalTheme UNKNOWN
      Theme could not be determined. Treated as dark for safety.
  • 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()
      Returns true if this theme is dark or unknown.
      Returns:
      true for DARK or UNKNOWN
    • isLight

      public boolean isLight()
      Returns true if this theme is light.
      Returns:
      true for LIGHT only
    • 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