{"id":48946791,"url":"https://github.com/andrestubbe/fasttheme","last_synced_at":"2026-04-17T17:07:07.232Z","repository":{"id":350648040,"uuid":"1207715788","full_name":"andrestubbe/FastTheme","owner":"andrestubbe","description":"WIP, OS-Aware Display \u0026 Theme Monitor for Java. Real-time detection of resolution, DPI scale, orientation, refresh rate, and Windows dark/light theme. JNI-native Windows API with instant event callbacks.","archived":false,"fork":false,"pushed_at":"2026-04-11T10:11:11.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-11T12:11:39.920Z","etag":null,"topics":["dark-mode","display-monitor","dpi-detection","java","jni","native-library","resolution-change","theme-detection","windows-api"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrestubbe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-11T09:53:28.000Z","updated_at":"2026-04-11T10:11:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/andrestubbe/FastTheme","commit_stats":null,"previous_names":["andrestubbe/fasttheme"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/andrestubbe/FastTheme","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrestubbe%2FFastTheme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrestubbe%2FFastTheme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrestubbe%2FFastTheme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrestubbe%2FFastTheme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrestubbe","download_url":"https://codeload.github.com/andrestubbe/FastTheme/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrestubbe%2FFastTheme/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31937754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T12:37:54.787Z","status":"ssl_error","status_checked_at":"2026-04-17T12:37:25.095Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dark-mode","display-monitor","dpi-detection","java","jni","native-library","resolution-change","theme-detection","windows-api"],"created_at":"2026-04-17T17:06:58.890Z","updated_at":"2026-04-17T17:07:07.226Z","avatar_url":"https://github.com/andrestubbe.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastTheme — Native Windows Theme, Titlebar Styling \u0026 Display API for Java [ALPHA]\n\n**Lightweight alternative to FlatLAF when you only need real OS theme events, titlebar styling, opacity, and display metrics.**\n\n[![WIP](https://img.shields.io/badge/status-WIP-yellow.svg)]()\n[![Build](https://img.shields.io/badge/build-passing-brightgreen.svg)]()\n[![Java](https://img.shields.io/badge/Java-17+-blue.svg)](https://www.java.com)\n[![Platform](https://img.shields.io/badge/Platform-Windows%2010+-lightgrey.svg)]()\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nFastTheme brings real Windows theming to Java applications: **Dark/Light Mode, Titlebar Styling, Window Opacity, and Display DPI** — all native, without replacing your Look-and-Feel.\n\n![FastTheme Terminal Demo](docs/screenshot.png)\n\n```java\n// Quick Start — Window Styling with FastTheme API\nimport fasttheme.FastTheme;\nimport javax.swing.*;\n\npublic class StyledWindow {\n    public static void main(String[] args) {\n        JFrame frame = new JFrame(\"FastTheme Window\");\n        frame.setSize(800, 600);\n        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n        frame.setVisible(true); // Must be visible first!\n        \n        // Apply native styling\n        long hwnd = FastTheme.getWindowHandle(frame);\n        if (hwnd != 0) {\n            FastTheme.setTitleBarColor(hwnd, 12, 12, 12);    // Dark gray\n            FastTheme.setTitleBarDarkMode(hwnd, true);       // Dark mode\n            FastTheme.setWindowTransparency(hwnd, 230);      // 90% opacity\n        }\n    }\n}\n\n// Or: Monitor display changes\nFastTheme theme = new FastTheme();\ntheme.setListener(new FastTheme.ThemeListener() {\n    @Override\n    public void onInitialState(int width, int height, int dpi, int refreshRate, \n                               FastTheme.Orientation orientation, boolean isDarkTheme) {\n        System.out.println(\"Display: \" + width + \"x\" + height + \" @ \" + dpi + \"DPI, \" + \n                          refreshRate + \"Hz, \" + (isDarkTheme ? \"DARK\" : \"LIGHT\"));\n    }\n    \n    @Override\n    public void onResolutionChanged(int width, int height, int dpi, int refreshRate) {\n        System.out.println(\"Resolution changed: \" + width + \"x\" + height);\n    }\n    \n    @Override\n    public void onOrientationChanged(FastTheme.Orientation o) {}\n    \n    @Override\n    public void onThemeChanged(boolean dark) {\n        System.out.println(\"Theme: \" + (dark ? \"DARK\" : \"LIGHT\"));\n    }\n});\ntheme.startMonitoring();\n```\n\nFastTheme is a **minimal, native, fast** library that provides:\n\n- **🎨 Native Window Styling** — Custom titlebar colors, transparency, and icons via DWM APIs\n- **📊 Display Monitoring** — Real-time notifications for resolution, DPI, orientation, refresh rate changes\n- **🌓 Theme Detection** — Windows dark/light mode detection\n\nUnlike Swing Look \u0026 Feels that replace rendering, FastTheme controls the **native Windows chrome** — giving you true OS integration without sacrificing Swing's capabilities.\n\n**Keywords:** java display monitor, screen resolution detection, dpi scaling detection, windows theme detection, dark mode detection java, display orientation monitor, refresh rate detection, jni native windows\n\n---\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Why FastTheme?](#why-fasttheme)\n- [Key Features](#key-features)\n- [Quick Start](#quick-start)\n- [Window Styling Demo](#window-styling-demo)\n- [API Overview](#api-overview)\n- [Use Cases](#use-cases)\n- [Build from Source](#build-from-source)\n- [Platform Support](#platform-support)\n- [Roadmap](#roadmap)\n- [License](#license)\n\n---\n\n## Installation\n\n### Maven (JitPack)\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.andrestubbe\u003c/groupId\u003e\n    \u003cartifactId\u003efasttheme\u003c/artifactId\u003e\n    \u003cversion\u003ev1.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFastCore is automatically included as a transitive dependency.\n\n### Gradle (JitPack)\n\n```groovy\nrepositories {\n    maven { url 'https://jitpack.io' }\n}\n\ndependencies {\n    implementation 'io.github.andrestubbe:fasttheme:v1.3.0'\n}\n```\n\n### Direct Download (Both JARs Required)\n\n- `fasttheme-1.3.0.jar` — Main library with DLL\n- `fastcore-1.0.0.jar` — [JNI loader](https://github.com/andrestubbe/FastCore/releases)\n\n```bash\njava -cp \"fasttheme-1.3.0.jar:fastcore-1.0.0.jar:.\" YourApp\n```\n\n---\n\n## Why FastTheme?\n\nWhen searching for **Java Theme**, **Java Dark Mode**, **Java Windows Theme**, **Java Titlebar Styling**, or **FlatLAF alternatives**, you usually need one of two things:\n\n**1. A complete UI framework** (FlatLAF) — replaces Swing's Look-and-Feel entirely\n\n**2. Just real Windows theme info** for your own UI — without replacing anything\n\nFastTheme is **Option 2**:\n- **Minimal** — no UI framework, no overhead\n- **Native** — real Windows API via JNI\n- **Fast** — direct access to OS events\n- **Non-intrusive** — works with your existing Swing/AWT code\n\n**Use FastTheme when you want:**\n- Native Dark/Light mode detection without changing your LAF\n- Custom titlebar colors while keeping standard Swing components\n- Real-time display metrics (DPI, resolution, refresh rate)\n- Window transparency without complex workarounds\n\n**Use FlatLAF when you want:**\n- A complete, polished cross-platform Look-and-Feel\n- Consistent UI across Windows, macOS, and Linux\n- Pre-built themes and component styling\n\n---\n\n## Key Features\n\n### 🎨 Native Window Styling (v1.1)\n- **Titlebar Color** — Set any RGB color, seamless with content\n- **Window Opacity** — 0-100% transparency via `SetLayeredWindowAttributes`\n- **Dark Mode** — Native Windows dark/light titlebar\n- **Custom Icons** — Programmatic icon generation\n\n### 📊 Display Monitoring\n- **Real-time detection** — Resolution, DPI, orientation, refresh rate\n- **Instant callbacks** — `WM_DISPLAYCHANGE`, `WM_DPICHANGED` events\n- **Complete metrics** — Scale %, DPI, orientation, refresh rate\n\n### 🌓 Theme Detection\n- **Dark/Light mode** — Windows theme detection via Registry\n- **System colors** — Access to Windows accent colors (planned)\n\n### ⚡ Technical\n- **Zero dependencies** — Java 17+ and Windows only\n- **Lightweight** — Minimal CPU/memory overhead\n- **MIT licensed** — free for commercial use\n- **Cross-platform Ready** — Windows implementation, extensible for Linux/macOS\n\n---\n\n## Quick Start\n\n```java\nimport fasttheme.FastTheme;\n\npublic class Main {\n    public static void main(String[] args) throws Exception {\n        FastTheme theme = new FastTheme();\n        \n        theme.setListener(new FastTheme.ThemeListener() {\n            @Override\n            public void onInitialState(int width, int height, int dpi, int refreshRate,\n                                       FastTheme.Orientation orientation, boolean isDarkTheme) {\n                int scalePercent = (dpi * 100) / 96;\n                System.out.println(\"INIT: \" + width + \"x\" + height + \n                                 \" | Scale: \" + scalePercent + \"% (DPI: \" + dpi + \")\" +\n                                 \" | \" + refreshRate + \"Hz\" +\n                                 \" | \" + orientation +\n                                 \" | Theme: \" + (isDarkTheme ? \"DARK\" : \"LIGHT\"));\n            }\n            \n            @Override\n            public void onResolutionChanged(int width, int height, int dpi, int refreshRate) {\n                int scalePercent = (dpi * 100) / 96;\n                String orientation = (width \u003e height) ? \"LANDSCAPE\" : \"PORTRAIT\";\n                System.out.println(\"EVENT: Resolution changed to \" + width + \"x\" + height + \n                                 \" | Scale: \" + scalePercent + \"% (DPI: \" + dpi + \")\" +\n                                 \" | \" + refreshRate + \"Hz\" +\n                                 \" | \" + orientation);\n            }\n            \n            @Override\n            public void onOrientationChanged(FastTheme.Orientation orientation) {\n                // Orientation changes included in resolution event\n            }\n            \n            @Override\n            public void onThemeChanged(boolean isDarkTheme) {\n                System.out.println(\"EVENT: Theme changed to \" + (isDarkTheme ? \"DARK\" : \"LIGHT\") + \" mode\");\n            }\n        });\n\n        if (theme.startMonitoring()) {\n            System.out.println(\"Monitoring started...\");\n            System.in.read(); // Press Enter to stop\n            theme.stopMonitoring();\n        }\n    }\n}\n```\n\n---\n\n## Window Styling API\n\nFastTheme v1.3.0 provides a **generic window styling API** via static native methods. Works with any Swing/AWT window.\n\n### Basic Window Styling\n\n```java\nimport fasttheme.FastTheme;\nimport javax.swing.*;\nimport java.awt.*;\n\npublic class StyledWindow {\n    public static void main(String[] args) {\n        JFrame frame = new JFrame(\"Styled Window\");\n        frame.setSize(800, 600);\n        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n        \n        // Content color (dark gray)\n        JPanel content = new JPanel();\n        content.setBackground(new Color(12, 12, 12));\n        frame.setContentPane(content);\n        \n        frame.setVisible(true); // Must be visible first!\n        \n        // Apply native styling\n        long hwnd = FastTheme.getWindowHandle(frame);\n        if (hwnd != 0) {\n            FastTheme.setTitleBarColor(hwnd, 12, 12, 12);      // Match content\n            FastTheme.setTitleBarTextColor(hwnd, 255, 255, 255); // White text\n            FastTheme.setTitleBarDarkMode(hwnd, true);         // Dark mode\n            FastTheme.setWindowTransparency(hwnd, 204);        // 80% opacity\n        }\n    }\n}\n```\n\n### System Information\n\n```java\n// Get real system values\nString resolution = FastTheme.getSystemResolution();  // \"1920x1080\"\nint dpi = FastTheme.getSystemDPI();                   // 96, 120, 144...\nint refresh = FastTheme.getSystemRefreshRate();       // 60, 120, 144...\nboolean dark = FastTheme.isSystemDarkMode();          // true/false\n```\n\n**Window Styling Features:**\n- 🎨 **Titlebar Color** — RGB background color for seamless design\n- ✏️ **Titlebar Text** — RGB text color for the window title\n- 🌙 **Dark Mode** — Native Windows dark/light titlebar\n- 🔲 **Transparency** — 0-100% window opacity\n\n**System Detection Features:**\n- 📊 **Resolution** — Current screen resolution\n- 🔍 **DPI Scaling** — System DPI value (96 = 100%)\n- 🔄 **Refresh Rate** — Display refresh rate in Hz\n- � **Theme Detection** — Windows dark/light mode\n\n**Native APIs Used:**\n- `DwmSetWindowAttribute` (DWMWA_CAPTION_COLOR, DWMWA_TEXT_COLOR, DWMWA_USE_IMMERSIVE_DARK_MODE)\n- `SetLayeredWindowAttributes` (WS_EX_LAYERED)\n- `GetDeviceCaps` / `EnumDisplaySettings` (DPI, Resolution, Refresh Rate)\n- `RegQueryValueEx` (Theme detection)\n\n---\n\n## API Reference\n\n### Display Monitoring\n\n| Method | Description |\n|--------|-------------|\n| `void setListener(ThemeListener listener)` | Set the event listener for display/theme changes |\n| `boolean startMonitoring()` | Start monitoring (creates background thread) |\n| `void stopMonitoring()` | Stop monitoring and release resources |\n\n### Window Styling (Static Methods)\n\nAll window styling methods are `public static native` and can be called from any thread:\n\n| Method | Parameters | Returns | Description |\n|--------|-----------|---------|-------------|\n| `getWindowHandle` | `Component component` | `long` | Extract native HWND from Swing window |\n| `setWindowTransparency` | `long hwnd, int alpha` | `boolean` | Set window opacity (0-255) |\n| `setTitleBarColor` | `long hwnd, int r, int g, int b` | `boolean` | Set titlebar background color |\n| `setTitleBarTextColor` | `long hwnd, int r, int g, int b` | `boolean` | Set titlebar text color |\n| `setTitleBarDarkMode` | `long hwnd, boolean enabled` | `boolean` | Enable/disable dark mode |\n| `getSystemResolution` | — | `String` | Current resolution (e.g., \"1920x1080\") |\n| `getSystemDPI` | — | `int` | System DPI (96 = 100% scaling) |\n| `getSystemRefreshRate` | — | `int` | Display refresh rate in Hz |\n| `isSystemDarkMode` | — | `boolean` | Windows dark mode status |\n\n### ThemeListener Interface\n\n| Method | Description |\n|--------|-------------|\n| `void onInitialState(int w, int h, int dpi, int refresh, Orientation o, boolean dark)` | Called once on startup |\n| `void onResolutionChanged(int w, int h, int dpi, int refresh)` | Resolution or DPI changed |\n| `void onOrientationChanged(Orientation o)` | Display orientation changed |\n| `void onThemeChanged(boolean dark)` | Windows theme changed |\n\n### Orientation Enum\n\n| Value | Description |\n|-------|-------------|\n| `LANDSCAPE` | Normal landscape (0°) |\n| `PORTRAIT` | Portrait (90° clockwise) |\n| `LANDSCAPE_FLIPPED` | Flipped landscape (180°) |\n| `PORTRAIT_FLIPPED` | Flipped portrait (270°) |\n\n---\n\n## Use Cases\n\n- **Adaptive UI Applications** — Automatically adjust layouts when DPI or resolution changes\n- **Multi-Monitor Apps** — Detect display configuration changes\n- **Tablet/Convertible Apps** — Handle orientation switches (landscape ↔ portrait)\n- **Gaming Overlays** — Match refresh rate for smooth rendering\n- **Theme-Aware Apps** — Apply dark/light theme based on OS preference\n- **System Monitoring Tools** — Track display configuration over time\n\n---\n\n## Platform Support\n\n| Platform | Status | Notes |\n|----------|--------|-------|\n| Windows 10/11 | ✅ Supported | Full feature set via JNI |\n| Linux | 🚧 Planned | X11/Wayland implementation |\n| macOS | 🚧 Planned | macOS display API implementation |\n\n---\n\n## Build from Source\n\n### Prerequisites\n\n- Java 17+ JDK\n- Visual Studio 2022 (or Build Tools)\n- Maven 3.8+\n\n### Windows Build\n\n```bash\n# Using the provided batch file (compiles Java + native DLL)\ncompile.bat\n\n# Or with Maven\nmvn clean package\n```\n\n### Project Structure\n\n```\nFastTheme/\n├── src/main/\n│   └── java/fasttheme/\n│       └── FastTheme.java           # Main API class\n│   └── resources/native/\n│       └── fasttheme.dll            # Native JNI library\n├── native/\n│   ├── FastTheme.cpp                # JNI implementation\n│   ├── FastTheme.h                  # JNI header\n│   └── FastTheme.def                # DLL exports\n├── examples/\n│   └── 00-basic-usage/\n│       └── src/main/java/fasttheme/\n│           ├── WindowDemo.java    # Window styling demo\n│           └── ConsoleDemo.java   # Display monitoring demo\n├── compile.bat                      # Windows build script\n├── pom.xml                          # Maven configuration\n└── README.md                        # This file\n```\n\n---\n\n## Changelog\n\n### v1.3.0 — Generic Window Styling API\n- ✨ **Generic JNI API** — Renamed JNI methods to `FastTheme_*`\n- ✨ **Static Native Methods** — All window styling via `FastTheme.*` static methods\n- ✨ **Doxygen Documentation** — Complete C++ API documentation\n- ✨ **Java Documentation** — Comprehensive Javadoc for all classes\n\n### v1.2.0 — Initial Window Styling\n- ✨ **TitleBar Color** — Custom RGB titlebar colors\n- ✨ **TitleBar Text** — Custom titlebar text color\n- ✨ **Dark Mode** — Native Windows dark/light mode toggle\n- ✨ **Transparency** — Window opacity control\n- ✨ **System Detection** — Resolution, DPI, refresh rate, theme detection\n\n### v1.0.0 — Display Monitoring\n- ✨ **Display Monitoring** — Real-time resolution, DPI, orientation changes\n- ✨ **Theme Detection** — Windows dark/light mode detection\n\n## Roadmap\n\n- [ ] **Real-time Theme Change Events** — Runtime dark/light mode switching detection\n- [ ] **Button Colors** — Control Windows caption button colors\n- [ ] **Multi-Monitor Support** — Per-display settings detection\n- [ ] **Linux Support** — X11/Wayland display monitoring\n- [ ] **macOS Support** — macOS display configuration monitoring\n\n---\n\n## License\n\nMIT License — See [LICENSE](LICENSE) file for details.\n\n---\n\n## Related Projects\n\n- [FastRobot](https://github.com/andrestubbe/fastrobot) — High-performance Java automation \u0026 screen capture\n\n---\n\n**Made with ⚡ by the FastJava Team**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrestubbe%2Ffasttheme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrestubbe%2Ffasttheme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrestubbe%2Ffasttheme/lists"}