Package com.helix.profiler.flamegraph
Class FlameGraphTheme
java.lang.Object
com.helix.profiler.flamegraph.FlameGraphTheme
Color and theme management for flame graph visualization in terminal TUIs and ANSI consoles.
Implements perceptual luminance-based contrast calculation to guarantee 100% legibility on diverse terminal themes (dark, light, solarized, high contrast) by always selecting an explicit, high-contrast foreground color for any background color.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringansiBg(int r, int g, int b) Generates an ANSI 24-bit escape sequence for background color.static StringansiBold()ANSI bold code.static StringansiFg(int r, int g, int b) Generates an ANSI 24-bit escape sequence for foreground color.static StringANSI reset code.com.googlecode.lanterna.TextColor.RGBBorder color for frame boxes.com.googlecode.lanterna.TextColor.RGBCanvas background color for the flame graph viewport.static com.googlecode.lanterna.TextColorgetContrastingTextColor(int r, int g, int b) Returns an explicit high-contrast foreground color (dark or bright) based on the perceptual luminance of the background RGB.static com.googlecode.lanterna.TextColorgetContrastingTextColor(com.googlecode.lanterna.TextColor backgroundColor) Overload accepting Lanterna TextColor.com.googlecode.lanterna.TextColor.RGBgetFrameBackgroundColor(String frameName, int depth, MetricType metricType) Computes a deterministic frame background color based on frame name, depth, and metric.getMode()com.googlecode.lanterna.TextColor.RGBFrame background color for the currently selected/active cursor frame.
-
Constructor Details
-
FlameGraphTheme
public FlameGraphTheme() -
FlameGraphTheme
-
-
Method Details
-
getMode
-
getContrastingTextColor
public static com.googlecode.lanterna.TextColor getContrastingTextColor(int r, int g, int b) Returns an explicit high-contrast foreground color (dark or bright) based on the perceptual luminance of the background RGB.- Parameters:
r- Red component (0-255)g- Green component (0-255)b- Blue component (0-255)- Returns:
- High-contrast TextColor (black/dark for light bg, white/bright for dark bg)
-
getContrastingTextColor
public static com.googlecode.lanterna.TextColor getContrastingTextColor(com.googlecode.lanterna.TextColor backgroundColor) Overload accepting Lanterna TextColor. -
getFrameBackgroundColor
public com.googlecode.lanterna.TextColor.RGB getFrameBackgroundColor(String frameName, int depth, MetricType metricType) Computes a deterministic frame background color based on frame name, depth, and metric.- Parameters:
frameName- Fully qualified or short frame namedepth- Call stack depth levelmetricType- CPU_TIME or ALLOCATION_BYTES- Returns:
- Background TextColor.RGB
-
getSelectedFrameBackgroundColor
public com.googlecode.lanterna.TextColor.RGB getSelectedFrameBackgroundColor()Frame background color for the currently selected/active cursor frame. -
getBorderColor
public com.googlecode.lanterna.TextColor.RGB getBorderColor()Border color for frame boxes. -
getCanvasBackgroundColor
public com.googlecode.lanterna.TextColor.RGB getCanvasBackgroundColor()Canvas background color for the flame graph viewport. -
ansiBg
Generates an ANSI 24-bit escape sequence for background color. -
ansiFg
Generates an ANSI 24-bit escape sequence for foreground color. -
ansiReset
ANSI reset code. -
ansiBold
ANSI bold code.
-