Class XMQTheme

java.lang.Object
org.libxmq.imp.XMQTheme

public class XMQTheme extends Object
XMQTheme The theme struct is used to prefix/postfix ANSI/HTML/TEX strings for XMQ tokens to colorize the printed xmq output.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an empty theme.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the pre/post color strings for the given color token, or null if no string is installed for that token.
    boolean
    Mirrors C installTheme: installs the default colors, then the theme spec, which is one or two (comma separated) themes.
    void
    setupHtmlColoring(boolean render_raw, int bg, String use_id, String use_class)
    Configures this theme for render-html.
    void
    setupTerminalColoring(boolean dark_mode, boolean use_color, boolean truecolor)
    Mirrors C setup_terminal_coloring: ansi colors without post strings, the active color is replayed after a nested color.
    void
    setupTexColoring(boolean dark_mode, boolean render_raw)
    Mirrors C setup_tex_coloring.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XMQTheme

      public XMQTheme()
      Creates an empty theme.
  • Method Details

    • getStringsFor

      public XMQThemeStrings getStringsFor(XMQColor color)
      Returns the pre/post color strings for the given color token, or null if no string is installed for that token. Mirrors the C getThemeStrings.
      Parameters:
      color - The token color.
      Returns:
      The pre/post strings, or null if not set.
    • setupHtmlColoring

      public void setupHtmlColoring(boolean render_raw, int bg, String use_id, String use_class)
      Configures this theme for render-html. Mirrors the C setup_html_coloring: the token color strings are set for both the styled and the raw (--nostyle) render, and the document/stylesheet scaffolding is only added when not raw.
      Parameters:
      render_raw - If true (the --nostyle option), only wrap the content in a single <pre> element without a full document.
      bg - 0 = follow the browser preference (class xmq_auto), 1 = forced dark (class xmq_dark), 2 = forced light (class xmq_light).
      use_id - The id of the pre element (--id=), or null.
      use_class - An extra class of the pre element (--class=), or null.
    • installTheme

      public boolean installTheme(String spec)
      Mirrors C installTheme: installs the default colors, then the theme spec, which is one or two (comma separated) themes.
      Parameters:
      spec - The theme spec, eg from --theme= or XMQ_THEME.
      Returns:
      True if the spec was understood.
    • setupTerminalColoring

      public void setupTerminalColoring(boolean dark_mode, boolean use_color, boolean truecolor)
      Mirrors C setup_terminal_coloring: ansi colors without post strings, the active color is replayed after a nested color.
      Parameters:
      dark_mode - Use the dark background colors.
      use_color - If false, no colors are installed.
      truecolor - Generate 24 bit colors instead of the 256 color palette.
    • setupTexColoring

      public void setupTexColoring(boolean dark_mode, boolean render_raw)
      Mirrors C setup_tex_coloring.
      Parameters:
      dark_mode - Use the bold/underline settings of the dark background colors.
      render_raw - If true (--nostyle), only print the content without a document.