ui.aggrid Unable to adapt to dark themes #3611
-
DescriptionI wrote a button to switch themes, and other components adapted well, but ui.aggrid Unable to adapt to dark themes subtitles_list = ui.aggrid(
{
'columnDefs': [
{'headerName': '序号', 'field': 'index', 'width': 30},
{'headerName': '时间码', 'field': 'time', 'width': 80},
{
'headerName': '内容',
'field': 'content',
# 启用单元格编辑器
'editable': True,
'cellEditor': 'agLargeTextCellEditor',
'cellEditorPopup': True,
'cellEditorParams': {
'maxLength': 100
},
},
],
'rowData': parse_srt_file(get_srt_file_path()),
'defaultColDef': {'flex': 1},
'rowSelection': 'single',
'onCellValueChanged': True,
'enableCellChangeFlash': True,
}
)
dark = ui.dark_mode()
ui.toggle({True: '深色模式', False: '浅色模式', None: '自动模式'}).bind_value(dark, 'value').classes(
'absolute inset-x-0 bottom-0 w-full') How can I make ui.aggrid adapt to dark themes? |
Beta Was this translation helpful? Give feedback.
Answered by
falkoschindler
Aug 27, 2024
Replies: 2 comments 2 replies
-
React Grid: Themes | AG Grid |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @mxiaonian, You can update the theme of aggrid = ui.aggrid({})
def handle_theme_change(e: events.ValueChangeEventArguments):
aggrid.classes(add='ag-theme-balham-dark' if e.value else 'ag-theme-balham',
remove='ag-theme-balham' if e.value else 'ag-theme-balham-dark')
ui.switch(on_change=handle_theme_change).bind_value(ui.dark_mode()) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
mxiaonian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @mxiaonian,
You can update the theme of
ui.aggrid
by adding and removing classes like this: