feat(theme): fix table row backgrounds and hub text contrast
This commit is contained in:
+9
-8
@@ -4673,15 +4673,16 @@ def render_heavy_text(app: App, label: str, content: str, id_suffix: str = "") -
|
||||
ctx_id = f"{label}_{id_suffix}"
|
||||
is_md = label in ('message', 'text', 'content', 'system')
|
||||
with imscope.indent():
|
||||
with imscope.child(f"heavy_text_child_{label}_{id_suffix}", imgui.ImVec2(0, 300), imgui.WindowFlags_.always_vertical_scrollbar):
|
||||
if is_md:
|
||||
markdown_helper.render(content, context_id=ctx_id)
|
||||
else:
|
||||
if app.ui_word_wrap:
|
||||
with imscope.text_wrap(imgui.get_content_region_avail().x):
|
||||
imgui.text(content)
|
||||
with imscope.style_color(imgui.Col_.child_bg, theme.get_table_color(is_alt=True)):
|
||||
with imscope.child(f"heavy_text_child_{label}_{id_suffix}", imgui.ImVec2(0, 300), imgui.WindowFlags_.always_vertical_scrollbar):
|
||||
if is_md:
|
||||
markdown_helper.render(content, context_id=ctx_id)
|
||||
else:
|
||||
imgui.text(content)
|
||||
if app.ui_word_wrap:
|
||||
with imscope.text_wrap(imgui.get_content_region_avail().x):
|
||||
imgui.text_colored(theme.get_color("text"), content)
|
||||
else:
|
||||
imgui.text_colored(theme.get_color("text"), content)
|
||||
|
||||
|
||||
#endregion: Misc Tools
|
||||
|
||||
@@ -139,6 +139,11 @@ def set_child_transparency(val: float) -> None:
|
||||
_child_transparency = val
|
||||
apply(_current_palette)
|
||||
|
||||
def get_table_color(is_alt: bool = False, alpha: float = 1.0) -> imgui.ImVec4:
|
||||
"""Returns a tone-mapped table row background color."""
|
||||
key = "table_row_bg_alt" if is_alt else "table_row_bg"
|
||||
return get_color(key, alpha=alpha)
|
||||
|
||||
def get_color(name: str, alpha: float = 1.0) -> imgui.ImVec4:
|
||||
"""Return a tone-mapped semantic color from the current palette."""
|
||||
palette_name = _current_palette
|
||||
@@ -165,6 +170,7 @@ def get_color(name: str, alpha: float = 1.0) -> imgui.ImVec4:
|
||||
"diff_added": (51, 230, 51),
|
||||
"diff_removed": (230, 51, 51),
|
||||
"diff_header": (77, 178, 255),
|
||||
"table_header_text": (255, 255, 255),
|
||||
}
|
||||
if name in fallbacks:
|
||||
rgb = fallbacks[name]
|
||||
|
||||
Reference in New Issue
Block a user