stylesheet

2023-06-20

HyperSBI2をSolarized色に染める

HYPER SBI 2: テーマ選択できるのは良いのだけど、ブラックorホワイト、どっちのテーマもものすごく目が疲れるんですけど…。旧バージョン時代のブルーカラー復活を切に願い…。

我慢して使っていたけどもう限界。リソースを編集して無理やり背景色を書き換えることにする。

手順

stylesheet.rccの差し替えを行う。元に戻せるよう、事前にC:\Program Files (x86)\SBI SECURITIES\HYPERSBI2\stylesheet.rccのバックアップを取っておく。

curl -o RccExtended-v1.0.5-win32.zip -L  https://github.com/zedxxx/rccextended/releases/download/v1.0.5/RccExtended-v1.0.5-win32.zip
Expand-Archive RccExtended-v1.0.5-win32.zip
cd .\RccExtended-v1.0.5-win32\
cp 'C:\Program Files (x86)\SBI SECURITIES\HYPERSBI2\stylesheet.rcc' .
.\rcc.exe --reverse
Set-ItemProperty .\qresource\res\stylesheet.rcc\stylesheet\dark\common -Name IsReadOnly -Value $false
sed -i -e 's/#0C0C0D/#073642/g' -e 's/#1a1a1a/#002B36/g' .\qresource\res\stylesheet.rcc\stylesheet\dark\common
cd .\qresource\rcc\
cp ..\..\rcc.exe .
.\rcc-make.bat
sudo cp .\stylesheet.rcc 'C:\Program Files (x86)\SBI SECURITIES\HYPERSBI2\stylesheet.rcc'

以上。

リソースの書き換えには危険が伴います。また、アップデートに失敗したり、編集内容が元に戻ったりといったことが起こります。記載の内容を十分理解したうえ、自己責任で行いましょう。

概要

リソースのアンパック

HYPER SBI 2のインストール先はC:\Program Files (x86)\SBI SECURITIES\HYPERSBI2\
qtアプリケーションのようなので、rccextendedツールを使用してリソースをアンパックする。リソースファイルは拡張子が.rccのもの。 目当てのものはstylesheet.rccに含まれていた。config.rccにもテーマらしきものが含まれていたが、今回は使用しない。

wget https://github.com/zedxxx/rccextended/releases/download/v1.0.5/RccExtended-v1.0.5-win32.zip
Expand-Archive RccExtended-v1.0.5-win32.zip
cd .\RccExtended-v1.0.5-win32\
cp 'C:\Program Files (x86)\SBI SECURITIES\HYPERSBI2\stylesheet.rcc' .
.\rcc.exe --reverse

スタイルの書き換え

手っ取り早くsed.\qresource\res\stylesheet.rcc\stylesheet\dark\commonの色置換を行った。 なぜか読み取り専用属性がついていたので、外してから実行。

Set-ItemProperty .\qresource\res\stylesheet.rcc\stylesheet\dark\common -Name IsReadOnly -Value $false
sed -i -e 's/#0C0C0D/#073642/g' -e 's/#1a1a1a/#002B36/g' .\qresource\res\stylesheet.rcc\stylesheet\dark\common

リソースの再パック

.\qresource\rcc\rcc-make.batを実行してstylesheet.rccを生成。rcc.exeにパスが通っていることが前提のようなので、rcc.exeを同じ場所にコピーして実行した。

cd .\qresource\rcc\
cp ..\..\rcc.exe .
.\rcc-make.bat

stylesheet.rccの差し替え

書き換え済みのstylesheet.rccで上書き。UACの権限昇格が必要。

sudo cp .\stylesheet.rcc 'C:\Program Files (x86)\SBI SECURITIES\HYPERSBI2\stylesheet.rcc'

コマンドが見つからない?

sed,sudoscoopでインストールできるよ。PowerShellを使おう。

参照