是否可以更改 Kdialog 文本颜色?

Is it possible to change Kdialog text color?

我的脚本中有一些 kdialog 文本框,我需要根据配置文件更改其文本颜色。可能吗?

您可以为 Kdialog window (--fg and --bg options) 设置前景色和背景色,但它无法为 window 上的单个单词着色。

如果您通读 source-code, you'll notice that Kdialog is just a thin layer on top of the KDE widget set, with options corresponding to a subset of dialog in 2005

是的 - 这是可能的,只需在 KDialog 参数中使用变量来影响颜色变化。

KDialogs 以多种方式支持样式 - 在您的情况下,更改 KDialog 中文本颜色的最简单方法是使用内联 HTML 样式(KDialog 支持基本的 Qt 样式,这是一个有限的子一组 CSS).

kdialog --title "KDialog" --caption "supports styles" --radiolist "<p style="padding:30"><font style="background:white"><br />&nbsp;Choose a type of <font style="color:red">KDialog</font> from the list&nbsp;</font></p>" 1 'Get user input' Off 2 'Display information' Off 3 'Get user choice' Off --geometry 450x230+200+200)

KDialogs 样式没有很好的记录(我 hoping to change that - 最终......),但非常可定制。

kdialog  --icon "preferences-system" --stylesheet "radiolist.qss" --title "KDialog" --caption "supports styles" --radiolist "<p style="padding:30"><font style="background:white"><br />&nbsp;Choose a type of <font style="color:red">KDialog</font> from the list&nbsp;</font></p>" 1 'Get user input' Off 2 'Display information' Off 3 'Get user choice' Off --geometry 450x230+200+200