public class ContrastAwareDarkMode extends Object
The algorithm works by:
| Modifier and Type | Field and Description |
|---|---|
static float | DEFAULT_VIBRANCYDefault vibrancy for dark mode conversion: 0.85 gives a good visual result. |
| Constructor and Description |
|---|
ContrastAwareDarkMode() |
| Modifier and Type | Method and Description |
|---|---|
static int | convertColor(int lightColor, int bgLight, int bgDark)Convert a single color from light to dark mode using default vibrancy. |
static int | convertColor(int lightColor, int bgLight, int bgDark, float vibrancy)Convert a single color from light to dark mode with custom vibrancy. |
static int[] | convertPalette(int[] lightColors, int bgLight, int bgDark)Convert a palette of colors from light to dark mode using default vibrancy. |
static int[] | convertPalette(int[] lightColors, int bgLight, int bgDark, float vibrancy)Convert a palette of colors from light to dark mode with custom vibrancy. |
public static final float DEFAULT_VIBRANCY
public static int[] convertPalette(int[] lightColors,
int bgLight,
int bgDark)lightColors - Array of original RGB colors (0xRRGGBB), no alpha channel.bgLight - Light theme background color (e.g., 0xFFFFFF for white).bgDark - Dark theme background color (e.g., 0x1E1F22 for Eclipse Dark mode editors background color).public static int[] convertPalette(int[] lightColors,
int bgLight,
int bgDark,
float vibrancy)The vibrancy parameter controls how "bright" or "vivid" the converted colors appear:
1.00f = Full brightness inversion (maximum contrast).0.85f = Slightly muted (recommended for most editors).0.75f = More subdued, easier on the eyes.0.50f = Very muted, low contrast.lightColors - Array of original RGB colors (0xRRGGBB), no alpha channel.bgLight - Light theme background color (e.g., 0xFFFFFF for white).bgDark - Dark theme background color (e.g., 0x1E1F22 for Eclipse Dark mode editors background color).vibrancy - Vibrancy factor (0.0 to 1.0). Controls color intensity in dark mode.public static int convertColor(int lightColor,
int bgLight,
int bgDark)lightColor - Original RGB color (0xRRGGBB), no alpha channel.bgLight - Light theme background color (e.g., 0xFFFFFF for white).bgDark - Dark theme background color (e.g., 0x1E1F22 for Eclipse Dark mode editors background color).public static int convertColor(int lightColor,
int bgLight,
int bgDark,
float vibrancy)lightColor - Original RGB color (0xRRGGBB), no alpha channel.bgLight - Light theme background color (e.g., 0xFFFFFF for white).bgDark - Dark theme background color (e.g., 0x1E1F22 for Eclipse Dark mode editors background color).vibrancy - Vibrancy factor (0.0 to 1.0).Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.