Skip to content

Instantly share code, notes, and snippets.

View IMS212's full-sized avatar

IMS IMS212

View GitHub Profile
@IMS212
IMS212 / Detector-Updated.java
Last active November 9, 2021 19:49 — forked from HanSolo/Detector.java
Detector-Updated: A plain Java class that offers some utility methods to detect dark theme on MacOS, Windows, and GNOME
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
// Based off HanSolo's Detector, with added support for GNOME, and removed support for macOS accent colors for Java 8 compatibility. Original: https://gist.github.com/HanSolo/7cf10b86efff8ca2845bf5ec2dd0fe1d
public class DarkModeDetector {
public enum OperatingSystem {WINDOWS, MACOS, LINUX, SOLARIS, NONE}
private static final String REGQUERY_UTIL = "reg query ";