feat(theme): Create NERV theme infrastructure in src/theme_nerv.py
This commit is contained in:
84
src/theme_nerv.py
Normal file
84
src/theme_nerv.py
Normal file
@@ -0,0 +1,84 @@
|
||||
from imgui_bundle import imgui
|
||||
|
||||
def _c(r: int, g: int, b: int, a: int = 255) -> tuple[float, float, float, float]:
|
||||
"""Convert 0-255 RGBA to 0.0-1.0 floats."""
|
||||
return (r / 255.0, g / 255.0, b / 255.0, a / 255.0)
|
||||
|
||||
NERV_ORANGE = _c(255, 152, 48)
|
||||
DATA_GREEN = _c(80, 255, 80)
|
||||
WIRE_CYAN = _c(32, 240, 255)
|
||||
ALERT_RED = _c(255, 72, 64)
|
||||
STEEL = _c(224, 224, 216)
|
||||
BLACK = _c(0, 0, 0)
|
||||
|
||||
NERV_PALETTE = {
|
||||
imgui.Col_.text: NERV_ORANGE,
|
||||
imgui.Col_.window_bg: BLACK,
|
||||
imgui.Col_.child_bg: BLACK,
|
||||
imgui.Col_.popup_bg: BLACK,
|
||||
imgui.Col_.border: NERV_ORANGE,
|
||||
imgui.Col_.border_shadow: _c(0, 0, 0, 0),
|
||||
imgui.Col_.frame_bg: BLACK,
|
||||
imgui.Col_.frame_bg_hovered: _c(255, 152, 48, 40),
|
||||
imgui.Col_.frame_bg_active: _c(255, 152, 48, 80),
|
||||
imgui.Col_.title_bg: BLACK,
|
||||
imgui.Col_.title_bg_active: NERV_ORANGE,
|
||||
imgui.Col_.title_bg_collapsed: BLACK,
|
||||
imgui.Col_.menu_bar_bg: BLACK,
|
||||
imgui.Col_.scrollbar_bg: BLACK,
|
||||
imgui.Col_.scrollbar_grab: NERV_ORANGE,
|
||||
imgui.Col_.scrollbar_grab_hovered: STEEL,
|
||||
imgui.Col_.scrollbar_grab_active: WIRE_CYAN,
|
||||
imgui.Col_.check_mark: DATA_GREEN,
|
||||
imgui.Col_.slider_grab: WIRE_CYAN,
|
||||
imgui.Col_.slider_grab_active: DATA_GREEN,
|
||||
imgui.Col_.button: BLACK,
|
||||
imgui.Col_.button_hovered: NERV_ORANGE,
|
||||
imgui.Col_.button_active: ALERT_RED,
|
||||
imgui.Col_.header: _c(255, 152, 48, 120),
|
||||
imgui.Col_.header_hovered: NERV_ORANGE,
|
||||
imgui.Col_.header_active: ALERT_RED,
|
||||
imgui.Col_.separator: STEEL,
|
||||
imgui.Col_.separator_hovered: WIRE_CYAN,
|
||||
imgui.Col_.separator_active: DATA_GREEN,
|
||||
imgui.Col_.resize_grip: NERV_ORANGE,
|
||||
imgui.Col_.resize_grip_hovered: STEEL,
|
||||
imgui.Col_.resize_grip_active: WIRE_CYAN,
|
||||
imgui.Col_.tab: BLACK,
|
||||
imgui.Col_.tab_hovered: NERV_ORANGE,
|
||||
imgui.Col_.tab_selected: NERV_ORANGE,
|
||||
imgui.Col_.tab_dimmed: BLACK,
|
||||
imgui.Col_.tab_dimmed_selected: _c(255, 152, 48, 80),
|
||||
imgui.Col_.plot_lines: WIRE_CYAN,
|
||||
imgui.Col_.plot_lines_hovered: DATA_GREEN,
|
||||
imgui.Col_.plot_histogram: DATA_GREEN,
|
||||
imgui.Col_.plot_histogram_hovered: WIRE_CYAN,
|
||||
imgui.Col_.text_selected_bg: _c(255, 152, 48, 100),
|
||||
imgui.Col_.drag_drop_target: DATA_GREEN,
|
||||
imgui.Col_.nav_cursor: NERV_ORANGE,
|
||||
imgui.Col_.nav_windowing_highlight: DATA_GREEN,
|
||||
imgui.Col_.nav_windowing_dim_bg: _c(0, 0, 0, 150),
|
||||
imgui.Col_.modal_window_dim_bg: _c(0, 0, 0, 150),
|
||||
}
|
||||
|
||||
def apply_nerv() -> None:
|
||||
"""Apply NERV theme with hard edges and specific palette."""
|
||||
style = imgui.get_style()
|
||||
for col_enum, rgba in NERV_PALETTE.items():
|
||||
style.set_color_(col_enum, imgui.ImVec4(*rgba))
|
||||
|
||||
# Hard Edges
|
||||
style.window_rounding = 0.0
|
||||
style.child_rounding = 0.0
|
||||
style.frame_rounding = 0.0
|
||||
style.popup_rounding = 0.0
|
||||
style.scrollbar_rounding = 0.0
|
||||
style.grab_rounding = 0.0
|
||||
style.tab_rounding = 0.0
|
||||
|
||||
# Border sizes
|
||||
style.window_border_size = 1.0
|
||||
style.frame_border_size = 1.0
|
||||
style.popup_border_size = 1.0
|
||||
style.child_border_size = 1.0
|
||||
style.tab_border_size = 1.0
|
||||
Reference in New Issue
Block a user