Class ConfigTheme

java.lang.Object
net.ixdarklord.coolcatcore.api.config.ConfigTheme

public final class ConfigTheme extends Object
How a mod's config screens look: its color schemes for dark and light mode, an optional background texture, and the icon beside the title (the mod's own icon unless set). Players pick dark or light mode for every mod with the sun/moon button in the top bar. Set it for all of a mod's screens (its configs, config list and pickers) with setForMod(java.lang.String, net.ixdarklord.coolcatcore.api.config.ConfigTheme), or for one config with ConfigBuilder.theme:

 ConfigTheme.setForMod("mymod", ConfigTheme.builder()
         .colors(ConfigColorScheme.tinted(0xFFFF8A3D))
         .background(ResourceLocation.fromNamespaceAndPath("mymod", "textures/gui/config_background.png"))
         .mode(ConfigTheme.BackgroundMode.COVER)
         .textureOpacity(0.8F)       // lets the panorama or world show through the texture a little
         .backgroundOpacity(0.3F)    // how strongly the backdrop color covers it
         .effects(ResourceLocation.fromNamespaceAndPath("mymod", "snow"))   // animated effects, instead of the starfall
         .build());
 
The texture is a full path in a resource pack (assets/mymod/textures/gui/config_background.png). Without one, the screens are see-through: the title panorama, or the world while playing, blurred behind the panels. While a world is open, screens show the blurred world instead, so players still see where they are.

Resource packs can restyle a mod's screens too, with assets/<modid>/coolcatlib/config_theme.json:


 {
   "base": "tinted",                // "dark", "light" or "tinted" (the dark scheme shaded toward the accent)
   "colors": { "accent": "#FF8A3D", "panel": "#C0141018" },
   "light_base": "light",           // the light mode's scheme: "light", "dark" or "tinted"
   "light_colors": { "accent": "#D9601A" },
   "icon": "mymod:textures/gui/config_icon.png",   // instead of the mod's own icon
   "background": "mymod:textures/gui/config_background.png",
   "background_mode": "cover",      // "cover", "stretch" or "tile"
   "tile_size": 32,
   "texture_opacity": 0.8,          // the texture's own opacity, from 0 to 1
   "background_opacity": 0.3,       // the backdrop color over the background, from 0 to 1
   "background_in_world": false,
   "popup_sprite": "mymod:config/popup",  // a nine-slice GUI sprite for popup panels
   "effects": ["mymod:snow"]        // animated effects by id; [] for none
 }
 
Every field is optional and overrides the mod's own theme; color names match ConfigColorScheme.Builder. Players can scale both opacities for every mod in CoolCatLib's client config.

Effects are animations drawn behind the panels, over the whole screen, or over each widget, registered by id on the client (ConfigEffects.register); every theme uses STARFALL unless it names its own.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    How the background texture fills the screen.
    static final class 
     
    static enum 
    Dark or light: each player's choice for every mod's config screens.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ConfigTheme
    CoolCatLib's own look: see-through to the title panorama or the world, in CoolCatLib's logo colors.
    static final net.minecraft.resources.ResourceLocation
    The built-in effect: soft glows in the accent and small faint stars falling, shifting with the mouse.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The dark mode's accent color, ARGB.
    @Nullable net.minecraft.resources.ResourceLocation
    The background texture's full path, or null for the see-through background.
    boolean
    Whether the texture is drawn in a world too, instead of the blurred world.
    float
    The opacity of the scheme's backdrop color drawn over the background (the texture, or the blurred panorama or world), from 0 (not drawn) to 1 (hides it completely).
     
    The colors in dark mode.
    The colors in a mode; players switch modes with the button in the config screens' top bar.
    List<net.minecraft.resources.ResourceLocation>
    The effects drawn, by id, in order (STARFALL by default; empty for none).
    forMod(String modId)
    The mod's theme, or DEFAULT; a resource pack's config_theme.json is applied on top when drawn.
    @Nullable net.minecraft.resources.ResourceLocation
    The icon beside the title in the top bar, or null for the mod's own icon (its logo on NeoForge).
    The colors in light mode: the ones set, or the light scheme in the dark scheme's accent.
     
    @Nullable net.minecraft.resources.ResourceLocation
    The GUI sprite popups (category popups, confirmations, the color picker) draw as their panel, or null for the scheme's flat panel.
    static void
    setForMod(String modId, ConfigTheme theme)
    The theme of every screen of a mod's configs that don't set their own.
    float
    The background texture's own opacity, from 0 to 1.
    int
    The size one tile is drawn at, for ConfigTheme.BackgroundMode.TILE; 0 for the texture's own size.
     

    Methods inherited from class java.lang.Object

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

    • STARFALL

      public static final net.minecraft.resources.ResourceLocation STARFALL
      The built-in effect: soft glows in the accent and small faint stars falling, shifting with the mouse.
    • DEFAULT

      public static final ConfigTheme DEFAULT
      CoolCatLib's own look: see-through to the title panorama or the world, in CoolCatLib's logo colors.
  • Method Details

    • builder

      public static ConfigTheme.Builder builder()
    • setForMod

      public static void setForMod(String modId, ConfigTheme theme)
      The theme of every screen of a mod's configs that don't set their own.
    • forMod

      public static ConfigTheme forMod(String modId)
      The mod's theme, or DEFAULT; a resource pack's config_theme.json is applied on top when drawn.
    • colors

      public ConfigColorScheme colors()
      The colors in dark mode.
    • lightColors

      public ConfigColorScheme lightColors()
      The colors in light mode: the ones set, or the light scheme in the dark scheme's accent.
    • colors

      public ConfigColorScheme colors(ConfigTheme.Mode mode)
      The colors in a mode; players switch modes with the button in the config screens' top bar.
    • accent

      public int accent()
      The dark mode's accent color, ARGB.
    • icon

      @Nullable public @Nullable net.minecraft.resources.ResourceLocation icon()
      The icon beside the title in the top bar, or null for the mod's own icon (its logo on NeoForge).
    • background

      @Nullable public @Nullable net.minecraft.resources.ResourceLocation background()
      The background texture's full path, or null for the see-through background.
    • mode

    • tileSize

      public int tileSize()
      The size one tile is drawn at, for ConfigTheme.BackgroundMode.TILE; 0 for the texture's own size.
    • backgroundOpacity

      public float backgroundOpacity()
      The opacity of the scheme's backdrop color drawn over the background (the texture, or the blurred panorama or world), from 0 (not drawn) to 1 (hides it completely). It keeps the panels readable over busy backgrounds.
    • textureOpacity

      public float textureOpacity()
      The background texture's own opacity, from 0 to 1. Below 1 the blurred panorama, or the world, shows through it.
    • backgroundInWorld

      public boolean backgroundInWorld()
      Whether the texture is drawn in a world too, instead of the blurred world.
    • popupSprite

      @Nullable public @Nullable net.minecraft.resources.ResourceLocation popupSprite()
      The GUI sprite popups (category popups, confirmations, the color picker) draw as their panel, or null for the scheme's flat panel. It should be a nine-slice sprite; the title is drawn 12 pixels from its top-left corner and content starts 30 pixels down, so its top border can hold a title bar.
    • effects

      public List<net.minecraft.resources.ResourceLocation> effects()
      The effects drawn, by id, in order (STARFALL by default; empty for none).
    • toBuilder

      public ConfigTheme.Builder toBuilder()