Modify ibus engine color

若使用的gtk顏色為深色系的話,那有的時候在輸入文字要選字的時候幾乎是看不到的,因為預設ibus-table輸入選字欄位是黑色字,因此可以透過以下的方法來修改成白色,比較容易看的清楚

$ sudo vim /usr/local/share/ibus-table/engine/table.py

463 attrs.append ( ibus.AttributeForeground (0x7700c3, 0, len(_phrase)) )
464 elif candi[-1] > 0:
465 # this is a sys phrase used by user:
466 attrs.append ( ibus.AttributeForeground (0x000000, 0, len(_phrase)) )
467 else:
468 # this is a system phrase haven't been used:
469 attrs.append ( ibus.AttributeForeground (0x000000, 0, len(_phrase)) )
470 self._lookup_table.append_candidate ( ibus.Text(_phrase + _tbks, attrs) )
471 self._lookup_table.show_cursor (False)

在 ibus.AttributeForeground的0x000000可以改成自己喜歡的色碼,範例如下:

463 attrs.append ( ibus.AttributeForeground (0x7700c3, 0, len(_phrase)) )
464 elif candi[-1] > 0:
465 # this is a sys phrase used by user:
466 attrs.append ( ibus.AttributeForeground (0xeeeeee, 0, len(_phrase)) )
467 else:
468 # this is a system phrase haven't been used:
469 attrs.append ( ibus.AttributeForeground (0xeeeeee, 0, len(_phrase)) )
470 self._lookup_table.append_candidate ( ibus.Text(_phrase + _tbks, attrs) )
471 self._lookup_table.show_cursor (False)

完成之後重新啟動一下ibus就行了

0 意見: