FastTheme 0.1.6 [ALPHA-2026-09-27] — High-Performance Native Window Styling & Dynamic Theming for Java
⚡ High-performance native Windows window styling, zero-allocation dynamic theming, and OS bridge for Java.
FastTheme brings native Windows 10/11 styling and schema-free dynamic theming to Java Swing, AWT, OpenGL, and CLI applications. It enables native dark mode title bars, Mica/Acrylic effects, and custom window decorations by bridging Java with the Desktop Window Manager (DWM) API, paired with an open, dynamically-allocated theme engine.
Watch Styling Demo (YouTube) | Watch Overlay Demo (YouTube) | Watch JMH Benchmark (YouTube)
import fasttheme.FastTheme;
import fasttheme.ThemeKeys;
import fasttheme.ThemeParser;
import java.awt.Color;
public class Demo {
public static void main(String[] args) {
// 1. Load schema-free theme directly from .theme text, .themebin binary, or file
FastTheme.load("""
THEME = Modern Dark
window.background = #13141F
window.text = #C3CDF7
titlebar.background = #0C0E10
accent.cyan = #00E0FF
button.hover = @accent.cyan
""");
// 2. Direct String Key Access (32-bit packed ARGB int)
int bg = FastTheme.get("window.background");
// 3. Fast cached slot access for hot loops (zero-allocation primitive array read)
int bgSlot = ThemeKeys.slot("window.background");
int fastBg = FastTheme.get(bgSlot);
// 4. AWT/Swing Color Object
Color awtBg = FastTheme.getColor("window.background");
}
}import fasttheme.FastTheme;
import javax.swing.JFrame;
import java.awt.Color;
public class NativeDemo {
public static void main(String[] args) {
JFrame frame = new JFrame("FastTheme Window");
frame.setSize(600, 400);
frame.setLocationRelativeTo(null);
frame.addNotify(); // Realizes native Win32 peer before showing to prevent flicker
long hwnd = FastTheme.getWindowHandle(frame);
if (hwnd != 0) {
// Automatically synchronizes DWM title bar and background from active theme
FastTheme.applyToWindow(hwnd);
}
frame.setVisible(true);
}
}import fasttheme.FastTheme;
import javax.swing.JFrame;
import java.awt.Color;
public class BorderlessDemo {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setSize(500, 320);
frame.setLocationRelativeTo(null);
frame.getContentPane().setBackground(new Color(20, 20, 24));
frame.addNotify(); // Realize native HWND peer
long hwnd = FastTheme.getWindowHandle(frame);
if (hwnd != 0) {
FastTheme.setBorderlessShadow(hwnd, true); // Removes titlebar, retains OS drop shadow
FastTheme.setOverlayDragHeight(hwnd, 48); // Top 48px act as invisible drag area
FastTheme.setCornerStyle(hwnd, 2); // Windows 11 Rounded Corners (2 = Rounded)
}
frame.setVisible(true);
}
}- Why FastTheme?
- Quick Start
- Key Features
- Real-World Scenarios
- Performance Benchmarks
- API Quick Reference
- Technical Demos & Benchmarks
- Installation
- Documentation
- Platform Support
- License
- Related Projects
Traditional Java Look & Feels (like FlatLaf, Radiance, or Nimbus) style internal Swing components, but leave the OS window frame untouched or resort to flickering, undecorated window simulations. FastTheme bridges the gap between Java and the native OS compositor while delivering zero-allocation theme execution:
-
Real Native Windows Chrome (Beyond Swing Simulation)
Controls the actual Windows 10/11 Desktop Window Manager (DWM) directly via JNI. Get real OS dark mode title bars, native caption colors, Mica/Acrylic glass materials, Windows 11 rounded corners, and native borderless drop shadows without custom decoration lag or resize jitter. -
Zero-Allocation Memory Architecture
Built like a game engine rather than a bloated UI framework. Themes are stored in flat, contiguousint[]primitive ARGB arrays delivering sub-nanosecond$O(1)$ slot reads with 0 bytes GC allocation in hot rendering loops. -
100% Schema-Free & Dynamic Registry
No rigid enum constraints or hardcoded schemas. Applications and plugins allocate custom theme tokens dynamically on demand (ThemeKeys.slot("custom.token")). -
Dual Formats (.theme & .themebin)
Support for both human-readable.themetext definitions (with@KEYalias resolution) and sub-microsecond binary.themebinpayloads for instant CLI and desktop startup. -
Unified Design Matrix (GUI, TUI, and OS)
A single theme definition simultaneously synchronizes Swing/AWT window chrome, borderless overlay geometries, and terminal CLI interfaces.
| Feature | FlatLaf / Swing Look&Feel | JNA DWM Hacks | FastTheme |
|---|---|---|---|
| Window Frame Styling | Swing custom decoration | Manual JNA calls | Native DWM (DwmSetWindowAttribute) |
| Windows 11 Rounded Corners | Emulated in Java graphics | Manual pointer struct | Native OS DWM Corner Preference |
| Runtime Color Query | Map<String, Object> / UIDefaults |
Object wrappers | Sub-nanosecond int[] Slot Lookup |
| Garbage Collection Churn | High (java.awt.Color objects) |
Native handle churn | 0 Bytes GC (Packed 32-bit ARGB int) |
| Format & Startup | XML / Properties parsing | Hardcoded C bindings | Dual Text (.theme) & Binary (.themebin) |
| Dependencies | External Look&Feel JAR | JNA Runtime (~15 MB) | Pure Java 17+ backed by FastCore |
- 🌙 Native Windows 10/11 Styling — Immersive Dark Mode, custom title bar captions, Mica materials, and borderless drop shadows.
-
⚡ Open Dynamic Key Registry — Unlimited dynamic keys registered on demand (
ThemeKeys.slot("KEY")) with$O(1)$ primitive array reads. -
📄 Dual File Formats — Human-readable
.themetext (supporting@KEYvariable aliasing) and sub-microsecond binary.themebin. - 🧮 WCAG 2.1 Contrast Safety — Relative luminance calculation, auto-readable text foreground selection, and tint/shade math.
-
🔄 Live Observer State — Global JVM state management with dynamic
ThemeListenerchange notifications. -
📦 Zero Dependency Bloat — Purely decoupled and standalone, requiring only
FastCorefor native library extraction.
- ⚡ Live Reactive Theming — Real-time theme reloading and user-customizable color palettes without window rebuilding or UI flicker.
- 🪟 Windows 11 Immersive Chrome — Seamless Mica backdrops, dark mode title bars, and custom accent styling for enterprise desktop suites.
- 🚀 Raycast & Spotlight Overlays — Draggable borderless launcher windows with native drop shadows, rounded corners, and subtle alpha glass.
- ♿ High-Contrast Accessible Tooling — Automated WCAG 2.1 compliance guaranteeing text readability on dynamic user palettes.
FastTheme is rigorously profiled using JMH to guarantee zero-allocation sub-nanosecond execution.
| Benchmark Operation | Score (ops/ms) | Ops per Second | Memory Allocation |
|---|---|---|---|
Cached Slot Array Read (FastTheme.get(slot)) |
~245,000 ops/ms | > 245 Million | 0 bytes / op (Zero GC) |
String Key Lookup (FastTheme.get(key)) |
~68,000 ops/ms | > 68 Million | 0 bytes / op (Zero GC) |
| WCAG Contrast Foreground Calculation | ~85,000 ops/ms | > 85 Million | 0 bytes / op (Zero GC) |
Binary .themebin Deserialization |
~1,200 ops/ms | > 1.2 Million | Sub-microsecond |
Run the benchmarks locally: .\run-benchmark.bat
| Method / Signature | Return Type | Description | Docs |
|---|---|---|---|
FastTheme.load(String text) |
void |
Parses and globally activates a .theme formatted text definition. |
Wiki |
FastTheme.load(byte[] binaryData) |
void |
Deserializes and globally activates a .themebin binary payload. |
Wiki |
FastTheme.loadFile(String path) / (File file)
|
void |
Loads and activates .theme or .themebin directly from a file path. |
Wiki |
FastTheme.addListener(ThemeListener) |
void |
Registers functional observers for live theme change events. | Wiki |
FastTheme.removeListener(ThemeListener) |
void |
Unregisters functional observers for live theme change events. | Wiki |
FastTheme.current() |
ThemeData |
Returns the currently active ThemeData instance. |
Wiki |
FastTheme.get(String key) / get(int slot)
|
int |
Retrieves packed 32-bit ARGB color integer ( |
Wiki |
FastTheme.getColor(String key) / (int slot)
|
Color |
Converts the resolved color to a standard Java AWT/Swing Color object. |
Wiki |
FastTheme.set(ThemeData theme) |
void |
Activates a ThemeData instance globally and notifies all registered listeners. |
Wiki |
| Method / Signature | Return Type | Description | Docs |
|---|---|---|---|
FastTheme.applyToWindow(long hwnd) / (Component comp) |
void |
Automatically applies title bar background, text, and window colors from active theme. | Wiki |
FastTheme.applyToWindow(hwnd, bgKey, fgKey, winKey) |
void |
Applies specific user-defined theme keys to the native window DWM chrome. | Wiki |
FastTheme.enableMica(long hwnd, boolean enabled) |
boolean |
Enables Windows 11 native Mica backdrop material effect (with legacy fallback). | Wiki |
FastTheme.getWindowHandle(Component comp) |
long |
Extracts the native 64-bit HWND handle from an AWT/Swing component. |
Wiki |
FastTheme.getConsoleWindowHandle() |
long |
Queries the native Win32 HWND of the active Windows console window (cmd.exe/ConHost). |
Wiki |
FastTheme.isNativeAvailable() |
boolean |
Checks whether the native Windows styling DLL is loaded and functional. | Wiki |
FastTheme.isSystemDarkMode() |
boolean |
Detects global Windows system dark mode setting. | Wiki |
FastTheme.setTitleBarDarkMode(long hwnd, boolean dark) |
boolean |
Toggles Windows 10/11 immersive dark mode for the native title bar. | Wiki |
FastTheme.setTitleBarColor(long hwnd, int r, int g, int b) |
boolean |
Sets the native caption background color on Windows 11. | Wiki |
FastTheme.setTitleBarTextColor(long hwnd, int r, int g, int b) |
boolean |
Sets the native title bar text/foreground color on Windows 11. | Wiki |
FastTheme.setWindowBackgroundColor(long hwnd, int r, int g, int b) |
boolean |
Sets the Win32 window background fill color. | Wiki |
FastTheme.setWindowTransparency(long hwnd, int alpha) |
boolean |
Sets window alpha blending from 0 (transparent) to 255 (fully opaque). |
Wiki |
FastTheme.setSystemBackdropType(long hwnd, int type) |
boolean |
Sets native Windows 11 backdrop material (BACKDROP_MICA, BACKDROP_ACRYLIC, BACKDROP_MICA_ALT). |
Wiki |
FastTheme.setCornerStyle(long hwnd, int style) |
boolean |
Sets window corner preference on Windows 11 (0=Default, 1=Square, 2=Rounded, 3=Small Rounded). |
Wiki |
FastTheme.setBorderlessShadow(long hwnd, boolean enabled) |
boolean |
Removes native title bar while preserving native OS drop shadow (Raycast-style). | Wiki |
FastTheme.setOverlayDragHeight(long hwnd, int height) |
boolean |
Defines top invisible grab area (in pixels) for draggable borderless windows. | Wiki |
FastTheme.setWindowButtonsVisible(long hwnd, boolean min, boolean max) |
boolean |
Toggles native minimize and maximize buttons in the window title bar. | Wiki |
FastTheme.setAlwaysOnTop(long hwnd, boolean alwaysOnTop) |
boolean |
Toggles native Win32 window topmost z-order. | Wiki |
| Method / Signature | Return Type | Description | Docs |
|---|---|---|---|
ThemeKeys.slot(String key) |
int |
Retrieves existing slot ID or registers a dynamic slot index on demand. | Wiki |
ThemeKeys.indexOf(String key) / nameOf(int slot) |
int / String |
Bidirectional translation between dynamic string key names and slot indices. | Wiki |
ThemeParser.parseText(String text) |
ThemeData |
Deserializes human-readable .theme content with @KEY alias resolution. |
Wiki |
ThemeParser.parseBinary(byte[] bytes) |
ThemeData |
Deserializes ultra-fast binary .themebin payload. |
Wiki |
ThemeColorUtil.getContrastForeground(int bg) |
int |
Calculates optimal high-contrast foreground color based on WCAG 2.1 relative luminance. | Wiki |
ThemeColorUtil.lighten(argb, amt) / darken(argb, amt) |
int |
Pure mathematical tinting and shading for hover/pressed UI states. | Wiki |
ThemeColorUtil.blend(c1, c2, float t) |
int |
Linear color interpolation and channel alpha blending. | Wiki |
| Case | Java Example | Launcher | Description |
|---|---|---|---|
| Window Styling & Transitions (YouTube) | Demo.java | run-demo.bat |
Native DWM title bar styling, dark mode detection, and live theme updates. |
| Premium Borderless Overlay (YouTube) | Demo2.java | run-demo2.bat |
Borderless Raycast-style overlay with native drop shadow, invisible drag area, and window transparency. |
| Windows 11 Mica Material | MicaDemo.java | run-demo-mica.bat |
Standard Windows 11 Mica backdrop (BACKDROP_MICA) with transparent Swing viewport. |
| Windows 11 Acrylic Blur | AcrylicDemo.java | run-demo-acrylic.bat |
Windows 11 Acrylic translucid blur backdrop (BACKDROP_ACRYLIC). |
| Windows 11 Mica Alt Material | MicaAltDemo.java | run-demo-mica-alt.bat |
Windows 11 high-contrast Mica Alt tabbed container backdrop (BACKDROP_MICA_ALT). |
| JMH Microbenchmark Suite | Benchmark.java | run-benchmark.bat |
Formal OpenJDK JMH zero-allocation slot array access, dynamic lookups, and parser throughput benchmarks. |
FastJava modules are published via JitPack and can be installed with standard build tools or direct download.
Add the JitPack repository and dependencies to your pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- Core FastTheme Engine -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastTheme</artifactId>
<version>0.1.6</version>
</dependency>
<!-- Required Native JNI loader -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastcore</artifactId>
<version>0.1.0</version>
</dependency>
<!-- FastFileFormat - Dual-Format (.theme/.themebin) Parser & Serializer -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastFileFormat</artifactId>
<version>0.1.1</version>
</dependency>
<!-- FastBinary - High-Performance Binary Bit-Packing & VarInt Engine -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastBinary</artifactId>
<version>0.1.1</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:FastTheme:0.1.6'
implementation 'com.github.andrestubbe:fastcore:0.1.0'
implementation 'com.github.andrestubbe:FastFileFormat:0.1.1'
implementation 'com.github.andrestubbe:FastBinary:0.1.1'
}Download the pre-built JARs directly to add them to your classpath:
- 📦 FastTheme-0.1.6.jar (Core Library & Native DLL)
- 📦 FastCore-0.1.0.jar (Required Native JNI loader)
- 📦 FastFileFormat-0.1.1.jar (Serialization & File Format Engine)
- 📦 FastBinary-0.1.1.jar (Binary Bit-Packing Engine)
- COMPILE.md: Full compilation guide (Maven & Native C++ Build Setup).
- REFERENCE.md: Exhaustive catalog of API contracts, data structures, and JNI methods.
- PHILOSOPHY.md: Dynamic slot architecture, Win32 DWM bridge, and design principles.
- ROADMAP.md: Planned milestone features and performance extensions.
- CHANGELOG.md: Version history and release notes.
| Platform | Architecture | Status | Notes |
|---|---|---|---|
| Windows 10/11 | x64 | ✅ Fully Supported | Native Win32 / DWM (Mica, Acrylic, Dark Mode, HWND bridge) |
| Linux | x64, ARM64 | 🟡 Partial | Dynamic Theming, FastBinary, Color Math & WCAG (Pure Java fallback) |
| macOS | Apple Silicon, x64 | 🟡 Partial | Dynamic Theming, FastBinary, Color Math & WCAG (Pure Java fallback) |
MIT License — See LICENSE for details.
- FastCore — Native JNI Loader and Utilities
- FastFileFormat — Dual text/binary serialization and parser engine
- FastAnimation — Zero overhead timeline orchestration
- FastTween — Zero overhead pool-based tweening
- FastDWM — Native Desktop Window Manager API
- FastDisplay — Native display telemetry and multi-monitor DPI scaling API
- FastANSI — High-performance terminal ANSI compositor
- FastUI — High-Performance GUI Framework
- FastTUI — Terminal User Interface Toolkit
Part of the FastJava Ecosystem — Making the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋

