# ui_theme.py import base64 import datetime import streamlit as st import streamlit.components.v1 as components # ===== [1] 페이지 기본 세팅 ===== def set_page( title: str = "AJIN Industrial Co., Ltd", layout: str = "wide", initial_sidebar_state: str = "expanded", # 기본은 열림. 토글은 사용자 자유 ): st.set_page_config( page_title=title, layout=layout, initial_sidebar_state=initial_sidebar_state, ) # ===== [2] 유틸: 이미지 → base64 ===== def _img_to_base64(path: str) -> str: with open(path, "rb") as f: return base64.b64encode(f.read()).decode() # ===== [3] 전역 CSS (상단바 유지, 사이드바 폭 연동, 배너/본문 밀림) ===== def inject_global_css( *, banner_h: str = "72px", header_h_default: str = "58px", # 초기 추정 높이 (JS로 실제값 동기화) navy_900: str = "#0a1424", navy_800: str = "#101d33", line: str = "#2a3a5a", text: str = "#e9eef7", muted: str = "#aeb7c6", yellow: str = "#ffbd39", green: str = "#69d06d", red: str = "#ff5858", hide_menu_footer: bool = False, # 메뉴/푸터 숨김 여부 (원하면 True) ): st.markdown( f""" """, unsafe_allow_html=True, ) # ===== [4] 고정 상단 배너 ===== def render_fixed_banner(*, logo_path: str, title: str): logo_b64 = _img_to_base64(logo_path) now_txt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M") st.markdown( f"""
""", unsafe_allow_html=True, ) # ===== [5] 사이드바: 날짜·시계 (필수) ===== def render_sidebar_clock(show_seconds: bool = False): now = datetime.datetime.now() time_fmt = "%H:%M:%S" if show_seconds else "%H:%M" st.sidebar.markdown( f"""