Class ThemeScript

java.lang.Object
wiiuu.ui.ThemeScript

public final class ThemeScript extends Object
WII-UU's theme language: small text files (.wtheme) that recolour the menu. A theme starts from the built-in light or dark colours and changes what it wants, with variables, colour functions, per-console tile colours and parts for light and dark mode:
theme "Sunset"
by "Someone"
base dark                          # light, dark, or auto (follow the computer)

let sun = #FF7A3D
accent = sun
card = lighten(#1A1033, 8%)
text-dim = mix(text, card, 35%)
background = gradient(#2B1748, #120A24)
consoles = mix(it, sun, 20%)       # every console tile; "it" is its own colour
console n64 = #00A651
font "Nunito", "DejaVu Sans"
when dark { stripes = none }
Statements end at the end of the line; # (followed by a space) and // start comments. Errors name the line and column, and suggest the closest name when one is misspelt. Evaluating needs no screen: wiiuu --theme-check uses it too.
  • Field Details

    • PROPERTIES

      public static final Map<String,String> PROPERTIES
      Every colour a theme can set, with what it is for (the order of the reference).
    • FUNCTIONS

      public static final Map<String,String> FUNCTIONS
      The colour functions, with their arguments (for the reference and error messages).
  • Method Details

    • evaluate

      public static ThemeScript.Result evaluate(String source, String fallbackName, Function<Boolean, Map<String,Color>> builtIn, Function<String,Color> consoleColour, Set<String> consoleIds, boolean systemDark) throws ThemeScript.Error
      Works a theme out.
      Parameters:
      source - the theme's text
      fallbackName - its name if it doesn't say one (the file's name)
      builtIn - WII-UU's own colours, light (false) or dark (true), with every property
      consoleColour - a console's own tile colour by id (null if there is no such console)
      consoleIds - every console id
      systemDark - whether the computer is in dark mode now (for base auto)
      Throws:
      ThemeScript.Error
    • nameOf

      public static String nameOf(String source)
      The name a theme gives itself (for lists), without working it out; null if it has none.