カラーテーマファイルのマニュアル追記、読み書きを修正
- カラーテーマ iniファイルフォーマットを変更
- マニュアル追記
- Unicode化(途中)
@@ -29,6 +29,14 @@ | ||
29 | 29 | |
30 | 30 | <hr> |
31 | 31 | |
32 | + <h2>TODO</h2> | |
33 | + <ul> | |
34 | + <li>BGSPIPath(画像を読み込むのに用いる、Susie Plugin が格納されているフォルダを指定します。)の | |
35 | + 設定GUIを作る | |
36 | + </ul> | |
37 | + | |
38 | + <hr> | |
39 | + | |
32 | 40 | <h2 id="preview">preview/file tab</h2> |
33 | 41 | |
34 | 42 | preview<br> |
@@ -63,7 +71,7 @@ | ||
63 | 71 | 上から順に背景画像が合成されていく。 |
64 | 72 | |
65 | 73 | <dl> |
66 | - <dt>base Color</dt> | |
74 | + <dt>Base Color</dt> | |
67 | 75 | <dd> |
68 | 76 | 背景画像を使用しない場合はこの色で塗りつぶされる。背景画像が描画されない部分がある場合もこの色で塗りつぶされる。 |
69 | 77 | </dd> |
@@ -3,178 +3,233 @@ | ||
3 | 3 | <html> |
4 | 4 | <head> |
5 | 5 | <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> |
6 | -<title>Theme file</TITLE> | |
6 | +<title>Theme 設定ファイル</TITLE> | |
7 | 7 | <meta http-equiv="Content-Style-Type" content="text/css"> |
8 | 8 | <link rel="stylesheet" href="../style.css" type="text/css"> |
9 | 9 | </head> |
10 | 10 | <body> |
11 | 11 | |
12 | + <h1>Themeファイル</h1> | |
12 | 13 | |
13 | - <h1>Theme 設定ファイル</h1> | |
14 | + <ul> | |
15 | + <li><a href="#themefile">Themeファイルについて</a></li> | |
16 | + <li><a href="#BGTheme">BG(背景) Theme</a></li> | |
17 | + <li><a href="#ColorTheme">Color Theme</a></li> | |
18 | + </ul> | |
14 | 19 | |
15 | - TODO | |
20 | + <h2>TODO</h2> | |
16 | 21 | <ul> |
17 | - <li>BGSPIPath(画像を読み込むのに用いる、Susie Plugin が格納されているフォルダを指定します。)の設定GUIを作る | |
18 | 22 | <li>仕様をちゃんと決める |
19 | 23 | <li>仕様に合わせて<a href="https://ttssh2.osdn.jp/tmp/color/">color picker(仮)</a>を修正 |
20 | 24 | </ul> |
21 | 25 | |
22 | - <h2>themeファイルの種類</h2> | |
26 | + <h2 id="themefile">themeファイルについて</h2> | |
23 | 27 | |
24 | 28 | テーマファイルにはいくつかの種類がある。 |
25 | 29 | |
26 | 30 | <dl> |
27 | - <dt>BG + カラー</dt> | |
31 | + <dt>BG(背景)テーマ</dt> | |
28 | 32 | <dd> |
29 | - [BG]と[Color Theme]の2セクション入ったファイル<br> | |
30 | - [BG]セクションには背景画像の設定だけ入っている | |
33 | + [BG]セクションが入ったファイル<br> | |
34 | + このセクションには背景画像の設定が入る | |
31 | 35 | </dd> |
32 | - <dt>BG のみ</dt> | |
36 | + <dt>カラーテーマ</dt> | |
33 | 37 | <dd> |
34 | - [BG]セクションのみのファイル<br> | |
35 | - [BG]セクションには背景画像の設定だけ入っている | |
36 | - </dd> | |
37 | - <dt>カラーのみ</dt> | |
38 | + [Color Theme]セクションが入ったファイル<br> | |
39 | + このセクションには文字の色の設定が入る | |
40 | + <dt>旧カラーテーマ (廃止予定)</dt> | |
38 | 41 | <dd> |
39 | - [Color Theme]のみのファイル<br> | |
42 | + [BG]セクションに文字の色の設定が入っている<br> | |
43 | + Tera Term 4 でサポートしていたカラーテーマ<br> | |
44 | + 読み込みはできるが廃止予定 | |
40 | 45 | </dd> |
41 | - <dt>BG + 旧カラー (廃止したい)</dt> | |
42 | - <dd> | |
43 | - [BG]セクションのみのファイル<br> | |
44 | - [BG]セクションには背景画像と文字の色情報が入っている<br> | |
45 | - [BG]セクションの色情報は廃止したい<br> | |
46 | - </dd> | |
47 | 46 | </dl> |
48 | 47 | |
49 | - <h3>BG theme</h3> | |
48 | + BG(背景)テーマとカラーテーマを別のファイルに保存しておくことも、 | |
49 | + 1つのファイルに両方を保存することもできる。 | |
50 | 50 | |
51 | - iniファイルの[BG]セクション部分 | |
51 | + フォーマットはWindowsのiniファイル。 | |
52 | 52 | |
53 | + <h2 id="BGTheme">BG(背景)テーマ</h2> | |
54 | + | |
55 | + セクション名は"[BG]" | |
56 | + | |
53 | 57 | <dl> |
54 | - <dt>BGPictureTone</dt> | |
58 | + <dt>BGDestColor</dt> | |
55 | 59 | <dd> |
56 | - 背景画像(Dest)にデスクトップ画像(Src1)どれぐらいブレンドするか<br> | |
57 | - BGSrc1Alpha = 255 - BGPictureTone<br> | |
58 | - 0=デスクトップ画像(Src1)が100%<br> | |
59 | - 255=背景画像(Dest)が100% | |
60 | + 背景画像を使用しない場合はこの色で塗りつぶされる。<br> | |
61 | + 背景画像が描画されない部分がある場合もこの色で塗りつぶされる。 | |
60 | 62 | </dd> |
61 | - <dt>BGFadeColor</dt> | |
63 | + | |
64 | + <dt>BGDestFile</dt> | |
62 | 65 | <dd> |
63 | - Src2の色<br> | |
64 | - BGFadeColor = BGSrc2Color | |
66 | + 背景画像 | |
67 | + ファイル名にワイルドカードが指定された場合、一致するファイルからランダムに一つ選びます。<br> | |
68 | + 相対パスを利用する場合は、テーマファイルからの相対パスを指定してください。<br> | |
69 | + 読み込めるファイルの種類は、BGSPIPath に格納されたプラグインによります。<br> | |
70 | + ビットマップはプラグインが無くても読み込めます。 | |
65 | 71 | </dd> |
66 | - <dt>BGFadeTone</dt> | |
67 | - <dd>DestとSrc1の合成画像に単色(Src2)をどれぐらいブレンドするか<br> | |
68 | - BGSrc2Alpha = 255 - BGFadeTone<br> | |
69 | - 0=単色(Src2)が100%<br> | |
70 | - 255=DestとSrc1の合成画像が100% | |
72 | + | |
73 | + <dt>BGDestPattern</dt> | |
74 | + <dd>背景画像描画方法 | |
75 | + <dl> | |
76 | + <dt>stretch</dt> | |
77 | + <dt>tile</dt> | |
78 | + <dt>center</dt> | |
79 | + <dt>fit_width</dt> | |
80 | + <dt>fit_height</dt> | |
81 | + <dt>autofit</dt> | |
82 | + <dt>autofill</dt> | |
83 | + <dd> | |
84 | + FitWidth、FitHeight は画像のアスペクト比を維持したまま、画像を拡大縮小します。<br> | |
85 | + AutoFit は、ウィンドウと画像の間に隙間ができないように、FitWidth と FitHeight を切り替えます。 | |
86 | + </dd> | |
87 | + </dl> | |
71 | 88 | </dd> |
72 | 89 | |
73 | - <dt>BGReverseTextTone</t> | |
90 | + <dt>BGSrc1Alpha</dt> | |
74 | 91 | <dd> |
75 | - 0 - 255<br> | |
76 | - The transparency value of the reverse text. | |
92 | + Windowsの壁紙画像をアルファブレンドする。<br> | |
93 | + 背景画像(Dest)にデスクトップ画像(Src1)どれぐらいブレンドするを指定する。<br> | |
94 | + 0のとき壁紙はブレンドされない。<br> | |
77 | 95 | </dd> |
78 | 96 | |
79 | - <dt>BGPictureFile</dt> | |
80 | - <dd>file name<br> | |
81 | - You can specify the image file name merging with the wall paper.<br> | |
82 | - Tera Term will randomly select one of files when the wild card is specified.<br> | |
83 | - Please specify the relative path from the theme file when you want to use the relative path.<br> | |
84 | - The kind of file that Tera Term can load is depend the plugin stored in BGSPIPath.<br> | |
85 | - Tera Term can load the bitmap file when there is not plugin.<br> | |
97 | + | |
98 | + <dt>BGSrc2Color</dt> | |
99 | + <dd> | |
100 | + 背景画像全体をアルファブレンドする色 | |
86 | 101 | </dd> |
87 | 102 | |
88 | - <dt>BGPicturePattern</dt> | |
89 | - <dd>Stretch<br> | |
90 | - Tile<br> | |
91 | - Center<br> | |
92 | - FitWidth<br> | |
93 | - FitHeight<br> | |
94 | - AutoFit<br> | |
95 | - You can specify the painting method of the image file.<br> | |
96 | - Both FitWidth and FitHeight can expand or reduce the image while the aspect ratio of the image preserves.<br> | |
97 | - AutoFit can exchange FitWidth for FitHeight not to generate the space between the window and the image. | |
103 | + <dt>BGSrc2Alpha</dt> | |
104 | + <dd> | |
105 | + アルファブレンド値<br> | |
106 | + DestとSrc1の合成画像に単色(Src2)をどれぐらいブレンドするか<br> | |
98 | 107 | </dd> |
99 | 108 | |
100 | - <dt>BGPictureBaseColor</dt> | |
101 | - <dd>R, G, B<br> | |
102 | - This color can paint between the image file and the window. | |
109 | + <dt>BGReverseTextTone</dt> | |
110 | + <dd> | |
111 | + 0 - 255<br> | |
112 | + 反転テキストの透明度 | |
103 | 113 | </dd> |
114 | + </dl> | |
104 | 115 | |
105 | - <dt>BGPictureTone</dt> | |
106 | - <dd>0 - 255<br> | |
107 | - The transparency value of the image file.</dd> | |
116 | + <h3 id="ColorTheme">color theme</h3> | |
108 | 117 | |
109 | - <dt>BGFadeTone</dt> | |
110 | - <dd>0 - 255<br> | |
111 | - <td>This option can enable the whole background to fade.</dd> | |
118 | + <h4>section</h4> | |
112 | 119 | |
113 | - <dt>BGFadeColor</dt> | |
114 | - <dd>R, G, B<br> | |
115 | - This option can configure the fade color.</dd> | |
120 | + "Color Theme" | |
121 | + | |
122 | + <h4>name</h4> | |
123 | + | |
124 | + <dl> | |
125 | + <dt>name</dt> | |
126 | + <dd>テーマ名、値は文字列</dd> | |
116 | 127 | </dl> |
117 | 128 | |
129 | + <h4>attribute color</h4> | |
130 | + | |
118 | 131 | <dl> |
119 | - <dt>VTFore, Red ...</dt> | |
120 | - <dd>R, G, B<br> | |
121 | - This option can configure the text color.</dd> | |
132 | + <dt>VTColor</dt> | |
133 | + <dd>通常文字色, SGR 0</dd> | |
134 | + | |
135 | + <dt>BoldColor</dt> | |
136 | + <dd>SGR 1</dd> | |
137 | + | |
138 | + <dt>VTUnderlineColor</dt> | |
139 | + <dd>SGR 4</dd> | |
140 | + | |
141 | + <dt>BlinkColor</dt> | |
142 | + <dd>SGR 5</dd> | |
143 | + | |
144 | + <dt>ReverseColor</dt> | |
145 | + <dd>SGR 7</dd> | |
146 | + | |
147 | + <dt>URLColor</dt> | |
148 | + <dd> | |
149 | + URL文字列<br> | |
150 | + Tera TermがURL文字列を検出したときに付加される文字アトリビュート | |
151 | + </dd> | |
152 | + | |
153 | + <dt>値 (0 or 1), (0 or 1), (fore red), (fore green), (fore blue), (back red), (back green), (back blue)</dt> | |
154 | + <dt>値 (0 or 1), (0 or 1), (fore), (back)</dt> | |
155 | + <dd> | |
156 | + <dl> | |
157 | + <dt>(0 or 1)</dt> | |
158 | + <dd> | |
159 | + 1=default色から変更する<br> | |
160 | + 0=変更しない<br> | |
161 | + (VTColorでは参照されない) | |
162 | + </dd> | |
163 | + <dt>(0 or 1)</dt> | |
164 | + <dd> | |
165 | + 1=文字属性(Bold attribute等)の独自色を有効<br> | |
166 | + 0=無効にする<br> | |
167 | + (VTColorでは参照されない) | |
168 | + </dd> | |
169 | + | |
170 | + <dt>(fore red), (fore green), (fore blue)</dt> | |
171 | + <dd>文字の色、各値は0から255</dd> | |
172 | + | |
173 | + <dt>(back red), (back green), (back blue)</dt> | |
174 | + <dd>背景の色、各値は0から255</dd> | |
175 | + | |
176 | + <dt>(fore), (back)</dt> | |
177 | + <dd> | |
178 | + #RRBBGG の形式で、各々00 から FF まで | |
179 | + </dd> | |
180 | + </dl> | |
181 | + </dd> | |
122 | 182 | </dl> |
123 | -</table> | |
124 | 183 | |
184 | + <h4>ANSI color</h4> | |
125 | 185 | |
126 | -<h2>Extension of theme file</h2> | |
186 | + 256色/16色 ANSI colorの最初の16色。<br> | |
187 | + 8色時は、Dark colorを使用しない | |
127 | 188 | |
128 | -<p> | |
129 | -A user can configure the extension of the theme file based on the theme\Advanced.sample file.<br> | |
130 | -For example, an image file(sample.jpg) can be drawn in the Tera Term background. | |
131 | -Please specify the .ini file at the BGThemeFile entry of the teraterm.ini file. | |
132 | -</p> | |
189 | + <dl> | |
190 | + <dt>ANSIColor=(0 or 1)</dt> | |
191 | + <dd> | |
192 | + 1=default色から変更する<br> | |
193 | + 0=変更しない | |
194 | + </dd> | |
195 | + </dl> | |
133 | 196 | |
134 | -<pre> | |
135 | -[BG] | |
136 | -; Advanced Setting | |
137 | -; Image source setting | |
138 | -; Type : Color / Picture / Wallpaper | |
139 | -: Pattern : Stretch / Tile / Center / FitWidth / FitHeight / AutoFit | |
140 | -; AntiAlias : On / Off | |
141 | -; Color : R,G,B (0-255) | |
142 | -; Alpha : 0-255 | |
143 | -; File : wildcard => random select | |
144 | -; Dest = (Src1 * Src1Alpha + Dest * (255 - Src1Alpha)) / 255 | |
145 | -; Dest = (Src2 * Src2Alpha + Dest * (255 - Src2Alpha)) / 255 | |
146 | -BGReverseTextAlpha = 192 | |
147 | -; | |
148 | -BGDestType = Picture | |
149 | -BGDestFile = sample.jpg | |
150 | -BGDestPattern = AutoFit | |
151 | -BGDestAntiAlias = On | |
152 | -BGDestColor = 0,0,0 | |
153 | -; | |
154 | -BGSrc1Type = Color | |
155 | -BGSrc1File = | |
156 | -BGSrc1Pattern = | |
157 | -BGSrc1AntiAlias = | |
158 | -BGSrc1Color = 32,32,32 | |
159 | -BGSrc1Alpha = 64 | |
160 | -; | |
161 | -BGSrc2Type = Color | |
162 | -BGSrc2File = | |
163 | -BGSrc2Pattern = | |
164 | -BGSrc2AntiAlias = | |
165 | -BGSrc2Color = 32,32,32 | |
166 | -BGSrc2Alpha = 64 | |
167 | -</pre> | |
197 | + <dl> | |
198 | + <dt>Fore</dt> | |
199 | + <dd>256 ANSI color 15番<br> | |
200 | + 通常文字色(Tera TermではVTColorが使用される) | |
201 | + </dd> | |
168 | 202 | |
169 | -<h2>color theme</h2> | |
203 | + <dt>Back</dt> | |
204 | + <dd>256 ANSI color 0番<br> | |
205 | + 通常背景色(Tera TermではVTColorが使用される) | |
206 | + </dd> | |
170 | 207 | |
171 | - TBD<br> | |
208 | + <dt>Red</dt> | |
209 | + <dt>Green</dt> | |
210 | + <dt>Yellow</dt> | |
211 | + <dt>Blue</dt> | |
212 | + <dt>Magenta</dt> | |
213 | + <dt>Cyan</dt> | |
214 | + <dt>DarkFore</dt> | |
215 | + <dt>DarkBack</dt> | |
216 | + <dt>DarkRed</dt> | |
217 | + <dt>DarkGreen</dt> | |
218 | + <dt>DarkYellow</dt> | |
219 | + <dt>DarkBlue</dt> | |
220 | + <dt>DarkMagenta</dt> | |
221 | + <dt>DarkCyan</dt> | |
222 | + <dd>各文字色</dd> | |
172 | 223 | |
173 | - TODO | |
174 | - <ul> | |
175 | - <li>仕様書く | |
176 | - <li>release/theme/color/readme.md にリンク張る | |
177 | - </ul> | |
224 | + <dt>値 (red), (green), (blue)</dt> | |
225 | + <dd>各値は0から255</dd> | |
178 | 226 | |
227 | + <dt>値 (color)</dt> | |
228 | + <dd> | |
229 | + #RRBBGG の形式で、各々00 から FF まで | |
230 | + </dd> | |
231 | + | |
232 | + </dl> | |
233 | + | |
179 | 234 | </body> |
180 | 235 | </html> |
@@ -29,6 +29,14 @@ | ||
29 | 29 | |
30 | 30 | <hr> |
31 | 31 | |
32 | + <h2>TODO</h2> | |
33 | + <ul> | |
34 | + <li>BGSPIPath(画像を読み込むのに用いる、Susie Plugin が格納されているフォルダを指定します。)の | |
35 | + 設定GUIを作る | |
36 | + </ul> | |
37 | + | |
38 | + <hr> | |
39 | + | |
32 | 40 | <h2 id="preview">preview/file tab</h2> |
33 | 41 | |
34 | 42 | preview<br> |
@@ -63,7 +71,7 @@ | ||
63 | 71 | 上から順に背景画像が合成されていく。 |
64 | 72 | |
65 | 73 | <dl> |
66 | - <dt>base Color</dt> | |
74 | + <dt>Base Color</dt> | |
67 | 75 | <dd> |
68 | 76 | 背景画像を使用しない場合はこの色で塗りつぶされる。背景画像が描画されない部分がある場合もこの色で塗りつぶされる。 |
69 | 77 | </dd> |
@@ -9,172 +9,227 @@ | ||
9 | 9 | </head> |
10 | 10 | <body> |
11 | 11 | |
12 | + <h1>Themeファイル</h1> | |
12 | 13 | |
13 | - <h1>Theme 設定ファイル</h1> | |
14 | + <ul> | |
15 | + <li><a href="#themefile">Themeファイルについて</a></li> | |
16 | + <li><a href="#BGTheme">BG(背景) Theme</a></li> | |
17 | + <li><a href="#ColorTheme">Color Theme</a></li> | |
18 | + </ul> | |
14 | 19 | |
15 | - TODO | |
20 | + <h2>TODO</h2> | |
16 | 21 | <ul> |
17 | - <li>BGSPIPath(画像を読み込むのに用いる、Susie Plugin が格納されているフォルダを指定します。)の設定GUIを作る | |
18 | 22 | <li>仕様をちゃんと決める |
19 | 23 | <li>仕様に合わせて<a href="https://ttssh2.osdn.jp/tmp/color/">color picker(仮)</a>を修正 |
20 | 24 | </ul> |
21 | 25 | |
22 | - <h2>themeファイルの種類</h2> | |
26 | + <h2 id="themefile">themeファイルについて</h2> | |
23 | 27 | |
24 | 28 | テーマファイルにはいくつかの種類がある。 |
25 | 29 | |
26 | 30 | <dl> |
27 | - <dt>BG + カラー</dt> | |
31 | + <dt>BG(背景)テーマ</dt> | |
28 | 32 | <dd> |
29 | - [BG]と[Color Theme]の2セクション入ったファイル<br> | |
30 | - [BG]セクションには背景画像の設定だけ入っている | |
33 | + [BG]セクションが入ったファイル<br> | |
34 | + このセクションには背景画像の設定が入る | |
31 | 35 | </dd> |
32 | - <dt>BG のみ</dt> | |
36 | + <dt>カラーテーマ</dt> | |
33 | 37 | <dd> |
34 | - [BG]セクションのみのファイル<br> | |
35 | - [BG]セクションには背景画像の設定だけ入っている | |
36 | - </dd> | |
37 | - <dt>カラーのみ</dt> | |
38 | + [Color Theme]セクションが入ったファイル<br> | |
39 | + このセクションには文字の色の設定が入る | |
40 | + <dt>旧カラーテーマ (廃止予定)</dt> | |
38 | 41 | <dd> |
39 | - [Color Theme]のみのファイル<br> | |
42 | + [BG]セクションに文字の色の設定が入っている<br> | |
43 | + Tera Term 4 でサポートしていたカラーテーマ<br> | |
44 | + 読み込みはできるが廃止予定 | |
40 | 45 | </dd> |
41 | - <dt>BG + 旧カラー (廃止したい)</dt> | |
42 | - <dd> | |
43 | - [BG]セクションのみのファイル<br> | |
44 | - [BG]セクションには背景画像と文字の色情報が入っている<br> | |
45 | - [BG]セクションの色情報は廃止したい<br> | |
46 | - </dd> | |
47 | 46 | </dl> |
48 | 47 | |
49 | - <h3>BG theme</h3> | |
48 | + BG(背景)テーマとカラーテーマを別のファイルに保存しておくことも、 | |
49 | + 1つのファイルに両方を保存することもできる。 | |
50 | 50 | |
51 | - iniファイルの[BG]セクション部分 | |
51 | + フォーマットはWindowsのiniファイル。 | |
52 | 52 | |
53 | + <h2 id="BGTheme">BG(背景)テーマ</h2> | |
54 | + | |
55 | + セクション名は"[BG]" | |
56 | + | |
53 | 57 | <dl> |
54 | - <dt>BGPictureTone</dt> | |
58 | + <dt>BGDestColor</dt> | |
55 | 59 | <dd> |
56 | - 背景画像(Dest)にデスクトップ画像(Src1)どれぐらいブレンドするか<br> | |
57 | - BGSrc1Alpha = 255 - BGPictureTone<br> | |
58 | - 0=デスクトップ画像(Src1)が100%<br> | |
59 | - 255=背景画像(Dest)が100% | |
60 | + 背景画像を使用しない場合はこの色で塗りつぶされる。<br> | |
61 | + 背景画像が描画されない部分がある場合もこの色で塗りつぶされる。 | |
60 | 62 | </dd> |
61 | - <dt>BGFadeColor</dt> | |
63 | + | |
64 | + <dt>BGDestFile</dt> | |
62 | 65 | <dd> |
63 | - Src2の色<br> | |
64 | - BGFadeColor = BGSrc2Color | |
66 | + 背景画像 | |
67 | + ファイル名にワイルドカードが指定された場合、一致するファイルからランダムに一つ選びます。<br> | |
68 | + 相対パスを利用する場合は、テーマファイルからの相対パスを指定してください。<br> | |
69 | + 読み込めるファイルの種類は、BGSPIPath に格納されたプラグインによります。<br> | |
70 | + ビットマップはプラグインが無くても読み込めます。 | |
65 | 71 | </dd> |
66 | - <dt>BGFadeTone</dt> | |
67 | - <dd>DestとSrc1の合成画像に単色(Src2)をどれぐらいブレンドするか<br> | |
68 | - BGSrc2Alpha = 255 - BGFadeTone<br> | |
69 | - 0=単色(Src2)が100%<br> | |
70 | - 255=DestとSrc1の合成画像が100% | |
72 | + | |
73 | + <dt>BGDestPattern</dt> | |
74 | + <dd>背景画像描画方法 | |
75 | + <dl> | |
76 | + <dt>stretch</dt> | |
77 | + <dt>tile</dt> | |
78 | + <dt>center</dt> | |
79 | + <dt>fit_width</dt> | |
80 | + <dt>fit_height</dt> | |
81 | + <dt>autofit</dt> | |
82 | + <dt>autofill</dt> | |
83 | + <dd> | |
84 | + FitWidth、FitHeight は画像のアスペクト比を維持したまま、画像を拡大縮小します。<br> | |
85 | + AutoFit は、ウィンドウと画像の間に隙間ができないように、FitWidth と FitHeight を切り替えます。 | |
86 | + </dd> | |
87 | + </dl> | |
71 | 88 | </dd> |
72 | 89 | |
73 | - <dt>BGReverseTextTone</dt> | |
90 | + <dt>BGSrc1Alpha</dt> | |
74 | 91 | <dd> |
75 | - 0 - 255<br> | |
76 | - 反転テキストの透明度 | |
92 | + Windowsの壁紙画像をアルファブレンドする。<br> | |
93 | + 背景画像(Dest)にデスクトップ画像(Src1)どれぐらいブレンドするを指定する。<br> | |
94 | + 0のとき壁紙はブレンドされない。<br> | |
77 | 95 | </dd> |
78 | 96 | |
79 | - <dt>BGPictureFile</dt> | |
97 | + | |
98 | + <dt>BGSrc2Color</dt> | |
80 | 99 | <dd> |
81 | - ファイル名<br> | |
82 | - 壁紙と合成する画像ファイル名を指定します。<br> | |
83 | - ファイル名にワイルドカードが指定された場合、一致するファイルからランダムに一つ選びます。<br> | |
84 | - 相対パスを利用する場合は、テーマファイルからの相対パスを指定してください。<br> | |
85 | - 読み込めるファイルの種類は、BGSPIPath に格納されたプラグインによります。<br> | |
86 | - ビットマップはプラグインが無くても読み込めます。 | |
100 | + 背景画像全体をアルファブレンドする色 | |
87 | 101 | </dd> |
88 | 102 | |
89 | - <dt>BGPicturePattern</dt> | |
90 | - <dd>Stretch<br> | |
91 | - Tile<br> | |
92 | - Center<br> | |
93 | - FitWidth<br> | |
94 | - FitHeight<br> | |
95 | - AutoFit<br> | |
96 | - 画像ファイルの描画方法を指定します。<br> | |
97 | - FitWidth、FitHeight は画像のアスペクト比を維持したまま、画像を拡大縮小します。<br> | |
98 | - AutoFit は、ウィンドウと画像の間に隙間ができないように、FitWidth と FitHeight を切り替えます。 | |
103 | + <dt>BGSrc2Alpha</dt> | |
104 | + <dd> | |
105 | + アルファブレンド値<br> | |
106 | + DestとSrc1の合成画像に単色(Src2)をどれぐらいブレンドするか<br> | |
99 | 107 | </dd> |
100 | 108 | |
101 | - <dt>BGPictureBaseColor</dt> | |
102 | - <dd>R, G, B<br> | |
103 | - 画像とウィンドウの間に隙間ができた場合、この色で塗られます。 | |
109 | + <dt>BGReverseTextTone</dt> | |
110 | + <dd> | |
111 | + 0 - 255<br> | |
112 | + 反転テキストの透明度 | |
104 | 113 | </dd> |
114 | + </dl> | |
105 | 115 | |
106 | - <dt>BGPictureTone</dt> | |
107 | - <dd>0 - 255<br> | |
108 | - 画像ファイルの透明度 | |
116 | + <h3 id="ColorTheme">color theme</h3> | |
117 | + | |
118 | + <h4>section</h4> | |
119 | + | |
120 | + "Color Theme" | |
121 | + | |
122 | + <h4>name</h4> | |
123 | + | |
124 | + <dl> | |
125 | + <dt>name</dt> | |
126 | + <dd>テーマ名、値は文字列</dd> | |
127 | + </dl> | |
128 | + | |
129 | + <h4>attribute color</h4> | |
130 | + | |
131 | + <dl> | |
132 | + <dt>VTColor</dt> | |
133 | + <dd>通常文字色, SGR 0</dd> | |
134 | + | |
135 | + <dt>BoldColor</dt> | |
136 | + <dd>SGR 1</dd> | |
137 | + | |
138 | + <dt>VTUnderlineColor</dt> | |
139 | + <dd>SGR 4</dd> | |
140 | + | |
141 | + <dt>BlinkColor</dt> | |
142 | + <dd>SGR 5</dd> | |
143 | + | |
144 | + <dt>ReverseColor</dt> | |
145 | + <dd>SGR 7</dd> | |
146 | + | |
147 | + <dt>URLColor</dt> | |
148 | + <dd> | |
149 | + URL文字列<br> | |
150 | + Tera TermがURL文字列を検出したときに付加される文字アトリビュート | |
109 | 151 | </dd> |
110 | 152 | |
111 | - <dt>BGFadeTone</dt> | |
112 | - <dd>0 - 255<br> | |
113 | - 背景全体をフェードします。</dd> | |
153 | + <dt>値 (0 or 1), (0 or 1), (fore red), (fore green), (fore blue), (back red), (back green), (back blue)</dt> | |
154 | + <dt>値 (0 or 1), (0 or 1), (fore), (back)</dt> | |
155 | + <dd> | |
156 | + <dl> | |
157 | + <dt>(0 or 1)</dt> | |
158 | + <dd> | |
159 | + 1=default色から変更する<br> | |
160 | + 0=変更しない<br> | |
161 | + (VTColorでは参照されない) | |
162 | + </dd> | |
163 | + <dt>(0 or 1)</dt> | |
164 | + <dd> | |
165 | + 1=文字属性(Bold attribute等)の独自色を有効<br> | |
166 | + 0=無効にする<br> | |
167 | + (VTColorでは参照されない) | |
168 | + </dd> | |
114 | 169 | |
115 | - <dt>BGFadeColor</dt> | |
116 | - <dd>R, G, B<br> | |
117 | - フェードしたときの色を指定します。</dd> | |
170 | + <dt>(fore red), (fore green), (fore blue)</dt> | |
171 | + <dd>文字の色、各値は0から255</dd> | |
172 | + | |
173 | + <dt>(back red), (back green), (back blue)</dt> | |
174 | + <dd>背景の色、各値は0から255</dd> | |
175 | + | |
176 | + <dt>(fore), (back)</dt> | |
177 | + <dd> | |
178 | + #RRBBGG の形式で、各々00 から FF まで | |
179 | + </dd> | |
180 | + </dl> | |
181 | + </dd> | |
118 | 182 | </dl> |
119 | 183 | |
184 | + <h4>ANSI color</h4> | |
185 | + | |
186 | + 256色/16色 ANSI colorの最初の16色。<br> | |
187 | + 8色時は、Dark colorを使用しない | |
188 | + | |
120 | 189 | <dl> |
121 | - <dt>VTFore や Red など (廃止)</dt> | |
122 | - <dd>R, G, B<br> | |
123 | - テキストの色を設定します。</dd> | |
190 | + <dt>ANSIColor=(0 or 1)</dt> | |
191 | + <dd> | |
192 | + 1=default色から変更する<br> | |
193 | + 0=変更しない | |
194 | + </dd> | |
124 | 195 | </dl> |
125 | 196 | |
126 | -<h2>テーマファイルの拡張設定</h2> | |
197 | + <dl> | |
198 | + <dt>Fore</dt> | |
199 | + <dd>256 ANSI color 15番<br> | |
200 | + 通常文字色(Tera TermではVTColorが使用される) | |
201 | + </dd> | |
127 | 202 | |
128 | -<p> | |
129 | -theme\Advanced.sample ファイルを利用して、拡張設定をすることができます。<br> | |
130 | -下記は、指定した画像ファイル(sample.jpg)を Tera Term の背景に描画する例で、 | |
131 | -teraterm.ini の BGThemeFile エントリで指定してください。 | |
132 | -</p> | |
203 | + <dt>Back</dt> | |
204 | + <dd>256 ANSI color 0番<br> | |
205 | + 通常背景色(Tera TermではVTColorが使用される) | |
206 | + </dd> | |
133 | 207 | |
134 | -<pre> | |
135 | -[BG] | |
136 | -; Advanced Setting | |
137 | -; Image source setting | |
138 | -; Type : Color / Picture / Wallpaper | |
139 | -: Pattern : Stretch / Tile / Center / FitWidth / FitHeight / AutoFit | |
140 | -; AntiAlias : On / Off | |
141 | -; Color : R,G,B (0-255) | |
142 | -; Alpha : 0-255 | |
143 | -; File : wildcard => random select | |
144 | -; Dest = (Src1 * Src1Alpha + Dest * (255 - Src1Alpha)) / 255 | |
145 | -; Dest = (Src2 * Src2Alpha + Dest * (255 - Src2Alpha)) / 255 | |
146 | -BGReverseTextAlpha = 192 | |
147 | -; | |
148 | -BGDestType = Picture | |
149 | -BGDestFile = sample.jpg | |
150 | -BGDestPattern = AutoFit | |
151 | -BGDestAntiAlias = On | |
152 | -BGDestColor = 0,0,0 | |
153 | -; | |
154 | -BGSrc1Type = Color | |
155 | -BGSrc1File = | |
156 | -BGSrc1Pattern = | |
157 | -BGSrc1AntiAlias = | |
158 | -BGSrc1Color = 32,32,32 | |
159 | -BGSrc1Alpha = 64 | |
160 | -; | |
161 | -BGSrc2Type = Color | |
162 | -BGSrc2File = | |
163 | -BGSrc2Pattern = | |
164 | -BGSrc2AntiAlias = | |
165 | -BGSrc2Color = 32,32,32 | |
166 | -BGSrc2Alpha = 64 | |
167 | -</pre> | |
208 | + <dt>Red</dt> | |
209 | + <dt>Green</dt> | |
210 | + <dt>Yellow</dt> | |
211 | + <dt>Blue</dt> | |
212 | + <dt>Magenta</dt> | |
213 | + <dt>Cyan</dt> | |
214 | + <dt>DarkFore</dt> | |
215 | + <dt>DarkBack</dt> | |
216 | + <dt>DarkRed</dt> | |
217 | + <dt>DarkGreen</dt> | |
218 | + <dt>DarkYellow</dt> | |
219 | + <dt>DarkBlue</dt> | |
220 | + <dt>DarkMagenta</dt> | |
221 | + <dt>DarkCyan</dt> | |
222 | + <dd>各文字色</dd> | |
168 | 223 | |
169 | -<h2>color theme</h2> | |
224 | + <dt>値 (red), (green), (blue)</dt> | |
225 | + <dd>各値は0から255</dd> | |
170 | 226 | |
171 | - TBD<br> | |
227 | + <dt>値 (color)</dt> | |
228 | + <dd> | |
229 | + #RRBBGG の形式で、各々00 から FF まで | |
230 | + </dd> | |
172 | 231 | |
173 | - TODO | |
174 | - <ul> | |
175 | - <li>仕様書く | |
176 | - <li>release/theme/color/readme.md にリンク張る | |
177 | - </ul> | |
232 | + </dl> | |
178 | 233 | |
179 | 234 | </body> |
180 | 235 | </html> |
@@ -1,5 +1,9 @@ | ||
1 | 1 | # color theme folder |
2 | 2 | |
3 | +- see [Setup Files]/[theme file] in help | |
4 | +- Tera Term color theme plugin was referened. | |
5 | + - https://osdn.net/users/doda/pf/TTXColorTheme/ | |
6 | + | |
3 | 7 | ## themes |
4 | 8 | |
5 | 9 | - Solarized Dark |
@@ -19,12 +23,3 @@ | ||
19 | 23 | - Color UniversalDesign 4 |
20 | 24 | - 色覚多様性に対応した設定例 |
21 | 25 | - カラーユニバーサルデザイン(CUD)推奨配色セット ver.4に準拠 |
22 | - | |
23 | -## format | |
24 | - | |
25 | -- 未決定 | |
26 | - - まだ変更すると思う | |
27 | - - TBD | |
28 | -- Tera Term カラーテーマプラグイン を参考にしました。 | |
29 | - - https://osdn.net/users/doda/pf/TTXColorTheme/ | |
30 | - |
@@ -66,22 +66,26 @@ | ||
66 | 66 | // color theme |
67 | 67 | //////////////////// |
68 | 68 | |
69 | +// Character Attributes | |
70 | +// Normal(SGR 0), BOLD(SGR 1),... | |
69 | 71 | typedef struct { |
70 | - BOOL change; | |
71 | - BOOL enable; | |
72 | - COLORREF fg; | |
73 | - COLORREF bg; | |
72 | + BOOL change; // TRUE/FALSE = default色から変更する/変更しない | |
73 | + BOOL enable; // TRUE/FALSE = この文字属性(Bold attribute等)の独自色を有効/無効にする | |
74 | + COLORREF fg; // Fore color (文字属性の独自色が有効な場合) | |
75 | + COLORREF bg; // Back color (文字属性の独自色が有効な場合) | |
74 | 76 | } TColorSetting; |
75 | 77 | |
78 | +// ANSI Color | |
76 | 79 | typedef struct { |
77 | - BOOL change; | |
78 | - BOOL enable; | |
79 | - COLORREF color[16]; | |
80 | + BOOL change; // TRUE/FALSE = default色から変更する/変更しない | |
81 | + //BOOL enable; // 不要か? | |
82 | + COLORREF color[16]; // ANSI color 256色 の最初の16色, (前半が暗い色,後半が原色の明るい色) | |
80 | 83 | } TAnsiColorSetting; |
81 | 84 | |
85 | +// color theme | |
82 | 86 | typedef struct { |
83 | - char name[50]; | |
84 | - TColorSetting vt; | |
87 | + wchar_t name[50]; | |
88 | + TColorSetting vt; // SGR 0 | |
85 | 89 | TColorSetting bold; // SGR 1 |
86 | 90 | TColorSetting underline; // SGR 4 |
87 | 91 | TColorSetting blink; // SGR 5 |
@@ -100,8 +104,7 @@ | ||
100 | 104 | |
101 | 105 | // file / themefile.cpp |
102 | 106 | void ThemeLoadBG(const wchar_t *file, BGTheme *bg_theme); |
103 | -void ThemeLoadColor(const wchar_t *fn, TColorTheme *color_theme); | |
104 | -void ThemeLoadColorOld(const wchar_t *file, TColorTheme *theme); | |
107 | +void ThemeLoadColor(const wchar_t *fname, TColorTheme *color_theme); | |
105 | 108 | void ThemeLoad(const wchar_t *fname, BGTheme *bg_theme, TColorTheme *color_theme); |
106 | 109 | void ThemeSaveBG(const BGTheme *bg_theme, const wchar_t *fname); |
107 | 110 | void ThemeSaveColor(TColorTheme *color_theme, const wchar_t *fname); |
@@ -431,7 +431,7 @@ | ||
431 | 431 | const int b = GetBValue(c); |
432 | 432 | |
433 | 433 | wchar_t color_str[64]; |
434 | - swprintf_s(color_str, L"0x%02x%02x%02x", r,g,b); | |
434 | + swprintf_s(color_str, L"#%02x%02x%02x", r,g,b); | |
435 | 435 | item.mask = LVIF_TEXT; |
436 | 436 | item.iItem = y; |
437 | 437 | item.iSubItem = 2; |
@@ -498,7 +498,7 @@ | ||
498 | 498 | //ListView_InsertColumn(hWndList, 1, &lvcol); |
499 | 499 | SendMessage(hWndList, LVM_INSERTCOLUMNA, 1, (LPARAM)&lvcol); |
500 | 500 | |
501 | - lvcol.pszText = (LPSTR)"value(RRGGBB)"; | |
501 | + lvcol.pszText = (LPSTR)"value(#RRGGBB)"; | |
502 | 502 | lvcol.iSubItem = 2; |
503 | 503 | //ListView_InsertColumn(hWndList, 1, &lvcol); |
504 | 504 | SendMessage(hWndList, LVM_INSERTCOLUMNA, 2, (LPARAM)&lvcol); |
@@ -748,7 +748,12 @@ | ||
748 | 748 | OPENFILENAMEW ofn = {}; |
749 | 749 | wchar_t theme_file[MAX_PATH]; |
750 | 750 | |
751 | - wcscpy_s(theme_file, _countof(theme_file), ts->EtermLookfeel.BGThemeFileW); | |
751 | + if (ts->EtermLookfeel.BGThemeFileW != NULL) { | |
752 | + wcscpy_s(theme_file, _countof(theme_file), ts->EtermLookfeel.BGThemeFileW); | |
753 | + } | |
754 | + else { | |
755 | + theme_file[0] = 0; | |
756 | + } | |
752 | 757 | |
753 | 758 | ofn.lStructSize = get_OPENFILENAME_SIZEW(); |
754 | 759 | ofn.hwndOwner = hWnd; |
@@ -35,6 +35,7 @@ | ||
35 | 35 | #include "asprintf.h" |
36 | 36 | #include "inifile_com.h" |
37 | 37 | #include "win32helper.h" |
38 | +#include "codeconv.h" | |
38 | 39 | |
39 | 40 | #include "theme.h" |
40 | 41 |
@@ -42,18 +43,36 @@ | ||
42 | 43 | #define BG_SECTION "BG" |
43 | 44 | #define BG_SECTIONW L"BG" |
44 | 45 | #define BG_DESTFILE "BGDestFile" |
45 | -#define BG_DESTFILEW L"BGDestFile" | |
46 | -//#define BG_THEME_IMAGEFILE "theme\\ImageFile.INI" | |
47 | -//#define BG_THEME_IMAGEFILE_DEFAULT "theme\\*.INI" | |
48 | -#define BG_THEME_IMAGE_BRIGHTNESS_DEFAULT 64 | |
49 | 46 | #define BG_THEME_IMAGE_BRIGHTNESS1 "BGSrc1Alpha" |
50 | -#define BG_THEME_IMAGE_BRIGHTNESS1W L"BGSrc1Alpha" | |
51 | 47 | #define BG_THEME_IMAGE_BRIGHTNESS2 "BGSrc2Alpha" |
52 | -//#define BG_THEME_IMAGEFILE_NAME "ImageFile.INI" | |
53 | -//#define BG_THEME_IMAGEFILE_NAMEW L"ImageFile.INI" | |
54 | -//#define BG_THEME_THEMEFILE_SCALE "Scale.INI" | |
55 | -//#define BG_THEME_THEMEFILE_TILE "Tile.INI" | |
56 | 48 | |
49 | +/** | |
50 | + * ANSI256色時の先頭16色 | |
51 | + * INIファイルから読み込むときのキーワードと色番号対応 | |
52 | + */ | |
53 | +static const struct { | |
54 | + int index; | |
55 | + const wchar_t *key; | |
56 | +} ansi_list[] = { | |
57 | + 7 + 8, L"Fore", | |
58 | + 0, L"Back", | |
59 | + 1 + 8, L"Red", | |
60 | + 2 + 8, L"Green", | |
61 | + 3 + 8, L"Yellow", | |
62 | + 4 + 8, L"Blue", | |
63 | + 5 + 8, L"Magenta", | |
64 | + 6 + 8, L"Cyan", | |
65 | + | |
66 | + 7, L"DarkFore", | |
67 | + 0 + 8, L"DarkBack", | |
68 | + 1, L"DarkRed", | |
69 | + 2, L"DarkGreen", | |
70 | + 3, L"DarkYellow", | |
71 | + 4, L"DarkBlue", | |
72 | + 5, L"DarkMagenta", | |
73 | + 6, L"DarkCyan", | |
74 | +}; | |
75 | + | |
57 | 76 | const BG_PATTERN_ST *ThemeBGPatternList(int index) |
58 | 77 | { |
59 | 78 | static const BG_PATTERN_ST bg_pattern_list[] = { |
@@ -72,28 +91,50 @@ | ||
72 | 91 | return &bg_pattern_list[index]; |
73 | 92 | } |
74 | 93 | |
94 | +static COLORREF LoadColorOneANSI(const wchar_t *section, const wchar_t *key, const wchar_t *file, COLORREF defcolor) | |
95 | +{ | |
96 | + int r; | |
97 | + wchar_t *str; | |
98 | + DWORD e = hGetPrivateProfileStringW(section, key, NULL, file, &str); | |
99 | + if (e != 0 || *str == 0) { | |
100 | + free(str); | |
101 | + return defcolor; | |
102 | + } | |
103 | + if (*str == L'#') { | |
104 | + // #RRGGBB 形式 | |
105 | + DWORD i32; | |
106 | + r = swscanf_s(str, L"#%08x", &i32); | |
107 | + if (r == 1) { | |
108 | + free(str); | |
109 | + return RGB((i32 & 0xff0000) >> 16, (i32 & 0x00ff00) >> 8, (i32 & 0x0000ff)); | |
110 | + } | |
111 | + } | |
112 | + // R, G, B 形式 | |
113 | + int red, green, blue; | |
114 | + r = swscanf_s(str, L"%d , %d , %d", &red, &green, &blue); | |
115 | + free(str); | |
116 | + if (r == 3) { | |
117 | + return RGB(red, green, blue); | |
118 | + } | |
119 | + return defcolor; | |
120 | +} | |
121 | + | |
75 | 122 | static COLORREF BGGetColor(const char *name, COLORREF defcolor, const wchar_t *file) |
76 | 123 | { |
77 | - unsigned int r, g, b; | |
78 | - char colorstr[256], defstr[256]; | |
79 | - | |
80 | - _snprintf_s(defstr, sizeof(defstr), _TRUNCATE, "%d,%d,%d", GetRValue(defcolor), GetGValue(defcolor), | |
81 | - GetBValue(defcolor)); | |
82 | - | |
83 | - GetPrivateProfileStringAFileW(BG_SECTION, name, defstr, colorstr, 255, file); | |
84 | - | |
85 | - r = g = b = 0; | |
86 | - | |
87 | - sscanf(colorstr, "%d , %d , %d", &r, &g, &b); | |
88 | - | |
89 | - return RGB(r, g, b); | |
124 | + const wchar_t *section = BG_SECTIONW; | |
125 | + wchar_t *keyW = ToWcharA(name); | |
126 | + COLORREF color = LoadColorOneANSI(section, keyW, file, defcolor); | |
127 | + free(keyW); | |
128 | + return color; | |
90 | 129 | } |
91 | 130 | |
92 | 131 | /* |
93 | 132 | * color theme用ロード |
94 | 133 | */ |
95 | -void ThemeLoadColorOld(const wchar_t *file, TColorTheme *theme) | |
134 | +static void ThemeLoadColorOld(const wchar_t *file, TColorTheme *theme) | |
96 | 135 | { |
136 | + theme->ansicolor.change = TRUE; | |
137 | + | |
97 | 138 | theme->ansicolor.color[IdFore] = BGGetColor("Fore", theme->ansicolor.color[IdFore], file); |
98 | 139 | theme->ansicolor.color[IdBack] = BGGetColor("Back", theme->ansicolor.color[IdBack], file); |
99 | 140 | theme->ansicolor.color[IdRed] = BGGetColor("Red", theme->ansicolor.color[IdRed], file); |
@@ -114,39 +155,64 @@ | ||
114 | 155 | |
115 | 156 | theme->vt.fg = BGGetColor("VTFore", theme->vt.fg, file); |
116 | 157 | theme->vt.bg = BGGetColor("VTBack", theme->vt.bg, file); |
158 | + theme->vt.change = TRUE; | |
159 | + theme->vt.enable = TRUE; | |
117 | 160 | |
118 | 161 | theme->blink.fg = BGGetColor("VTBlinkFore", theme->blink.fg, file); |
119 | 162 | theme->blink.bg = BGGetColor("VTBlinkBack", theme->blink.bg, file); |
163 | + theme->blink.change = TRUE; | |
164 | + theme->blink.enable = TRUE; | |
120 | 165 | |
121 | 166 | theme->bold.fg = BGGetColor("VTBoldFore", theme->bold.fg, file); |
122 | 167 | theme->bold.bg = BGGetColor("VTBoldBack", theme->bold.bg, file); |
168 | + theme->bold.change = TRUE; | |
169 | + theme->bold.enable = TRUE; | |
123 | 170 | |
124 | 171 | theme->underline.fg = BGGetColor("VTUnderlineFore", theme->underline.fg, file); |
125 | 172 | theme->underline.bg = BGGetColor("VTUnderlineBack", theme->underline.bg, file); |
173 | + theme->underline.change = TRUE; | |
174 | + theme->underline.enable = TRUE; | |
126 | 175 | |
127 | 176 | theme->reverse.fg = BGGetColor("VTReverseFore", theme->reverse.fg, file); |
128 | 177 | theme->reverse.bg = BGGetColor("VTReverseBack", theme->reverse.bg, file); |
178 | + theme->reverse.change = TRUE; | |
179 | + theme->reverse.enable = TRUE; | |
129 | 180 | |
130 | 181 | theme->url.fg = BGGetColor("URLFore", theme->url.fg, file); |
131 | 182 | theme->url.bg = BGGetColor("URLBack", theme->url.bg, file); |
183 | + theme->url.change = TRUE; | |
184 | + theme->url.enable = TRUE; | |
132 | 185 | } |
133 | 186 | |
134 | 187 | /** |
135 | - * BGをロード | |
188 | + * save color one attribute | |
136 | 189 | */ |
137 | -static void BGSaveColorOne(const TColorSetting *color, const char *key, const wchar_t *fn) | |
190 | +static void SaveColorAttr(const wchar_t *section, const wchar_t *key, const TColorSetting *color, const wchar_t *fn) | |
138 | 191 | { |
139 | - char buf[512]; | |
192 | + wchar_t *buf; | |
140 | 193 | COLORREF fg = color->fg; |
141 | 194 | COLORREF bg = color->bg; |
195 | + int sp_len = 20 - (int)wcslen(key); | |
196 | + aswprintf(&buf, L"%*.*s %d,%d, %3hhu,%3hhu,%3hhu, %3hhu,%3hhu,%3hhu ; #%02x%02x%02x, #%02x%02x%02x", | |
197 | + sp_len, sp_len, L" ", | |
198 | + color->change, color->enable, | |
199 | + GetRValue(fg), GetGValue(fg), GetBValue(fg), | |
200 | + GetRValue(bg), GetGValue(bg), GetBValue(bg), | |
201 | + GetRValue(fg), GetGValue(fg), GetBValue(fg), | |
202 | + GetRValue(bg), GetGValue(bg), GetBValue(bg)); | |
203 | + WritePrivateProfileStringW(section, key, buf, fn); | |
204 | + free(buf); | |
205 | +} | |
142 | 206 | |
143 | - sprintf(buf, "%d,%d, %d,%d,%d, %d,%d,%d", 1, 1, | |
144 | - GetRValue(fg), GetGValue(fg), GetBValue(fg), | |
145 | - GetRValue(bg), GetGValue(bg), GetBValue(bg)); | |
146 | - WritePrivateProfileStringAFileW("Color Theme", key, buf, fn); | |
207 | +static void BGSaveColorOne(const TColorSetting *color, const char *key, const wchar_t *fn) | |
208 | +{ | |
209 | + const wchar_t *section = L"Color Theme"; | |
210 | + wchar_t *keyW = ToWcharA(key); | |
211 | + SaveColorAttr(section, keyW, color, fn); | |
212 | + free(keyW); | |
147 | 213 | } |
148 | 214 | |
149 | -static void BGSaveColorANSI(TAnsiColorSetting *color, const wchar_t *fn) | |
215 | +static void BGSaveColorANSI(const TAnsiColorSetting *color, const wchar_t *fn) | |
150 | 216 | { |
151 | 217 | int i; |
152 | 218 | wchar_t *buff = NULL; |
@@ -155,7 +221,7 @@ | ||
155 | 221 | for (i = 0; i < 16; i++) { |
156 | 222 | wchar_t color_str[32]; |
157 | 223 | const COLORREF c = color->color[i]; |
158 | - swprintf(color_str, _countof(color_str), L"%d,%d,%d, ", GetRValue(c), GetGValue(c), GetBValue(c)); | |
224 | + swprintf(color_str, _countof(color_str), L"%hhu,%hhu,%hhu, ", GetRValue(c), GetGValue(c), GetBValue(c)); | |
159 | 225 | awcscat(&buff, color_str); |
160 | 226 | } |
161 | 227 |
@@ -163,8 +229,39 @@ | ||
163 | 229 | free(buff); |
164 | 230 | } |
165 | 231 | |
166 | -void ThemeSaveColor(TColorTheme *color_theme, const wchar_t *fn) | |
232 | +static void SaveColorOneANSI(const wchar_t *section, const wchar_t *key, const wchar_t *file, COLORREF color, int index) | |
167 | 233 | { |
234 | + const BYTE r = GetRValue(color); | |
235 | + const BYTE g = GetGValue(color); | |
236 | + const BYTE b = GetBValue(color); | |
237 | + int sp_len = 20 - (int)wcslen(key); | |
238 | + wchar_t *str; | |
239 | + aswprintf(&str, L"%*.*s %3hhu, %3hhu, %3hhu ; #%02hhx%02hhx%02hhx ; ANSIColor[%2d]", | |
240 | + sp_len, sp_len, L" ", | |
241 | + r, g, b, r, g, b, index); | |
242 | + WritePrivateProfileStringW(section, key, str, file); | |
243 | + free(str); | |
244 | +} | |
245 | + | |
246 | +static void SaveColorANSINew(const wchar_t *section, const TAnsiColorSetting *color, const wchar_t *fname) | |
247 | +{ | |
248 | + wchar_t *str; | |
249 | + aswprintf(&str, L"%d", color->change); | |
250 | + WritePrivateProfileStringW(section, L"ANSIColor", str, fname); | |
251 | + free(str); | |
252 | + | |
253 | + for (int i = 0; i < _countof(ansi_list); i++) { | |
254 | + const int index = ansi_list[i].index; | |
255 | + const wchar_t *key = ansi_list[i].key; | |
256 | + SaveColorOneANSI(section, key, fname, color->color[index], index); | |
257 | + } | |
258 | +} | |
259 | + | |
260 | +/** | |
261 | + * カラーテーマの保存 | |
262 | + */ | |
263 | +void ThemeSaveColorOld(TColorTheme *color_theme, const wchar_t *fn) | |
264 | +{ | |
168 | 265 | WritePrivateProfileStringAFileW("Color Theme", "Theme", "teraterm theme editor", fn); |
169 | 266 | |
170 | 267 | BGSaveColorOne(&(color_theme->vt), "VTColor", fn); |
@@ -172,10 +269,26 @@ | ||
172 | 269 | BGSaveColorOne(&(color_theme->blink), "BlinkColor", fn); |
173 | 270 | BGSaveColorOne(&(color_theme->reverse), "ReverseColor", fn); |
174 | 271 | BGSaveColorOne(&(color_theme->url), "URLColor", fn); |
272 | + BGSaveColorOne(&(color_theme->underline), "VTUnderlineColor", fn); | |
175 | 273 | |
176 | 274 | BGSaveColorANSI(&(color_theme->ansicolor), fn); |
177 | 275 | } |
178 | 276 | |
277 | +void ThemeSaveColor(TColorTheme *color_theme, const wchar_t *fn) | |
278 | +{ | |
279 | + const wchar_t *section = L"Color Theme"; | |
280 | + WritePrivateProfileStringW(section, L"Theme", color_theme->name, fn); | |
281 | + | |
282 | + BGSaveColorOne(&(color_theme->vt), "VTColor", fn); | |
283 | + BGSaveColorOne(&(color_theme->bold), "BoldColor", fn); | |
284 | + BGSaveColorOne(&(color_theme->blink), "BlinkColor", fn); | |
285 | + BGSaveColorOne(&(color_theme->reverse), "ReverseColor", fn); | |
286 | + BGSaveColorOne(&(color_theme->url), "URLColor", fn); | |
287 | + BGSaveColorOne(&(color_theme->underline), "VTUnderlineColor", fn); | |
288 | + | |
289 | + SaveColorANSINew(section, &(color_theme->ansicolor), fn); | |
290 | +} | |
291 | + | |
179 | 292 | void WriteInt3(const char *Sect, const char *Key, const wchar_t *FName, |
180 | 293 | int i1, int i2, int i3) |
181 | 294 | { |
@@ -350,9 +463,9 @@ | ||
350 | 463 | // ANSIColor16は、明るい/暗いグループが入れ替わっている |
351 | 464 | const static int index256[] = { |
352 | 465 | 0, |
466 | + 1, 2, 3, 4, 5, 6, 7, | |
467 | + 8, | |
353 | 468 | 9, 10, 11, 12, 13, 14, 15, |
354 | - 8, | |
355 | - 1, 2, 3, 4, 5, 6, 7 | |
356 | 469 | }; |
357 | 470 | |
358 | 471 | GetPrivateProfileStringAFileW("Color Theme", "ANSIColor", "0", Buff, sizeof(Buff), fn); |
@@ -361,7 +474,7 @@ | ||
361 | 474 | color->change = c; |
362 | 475 | |
363 | 476 | GetNthNum(Buff, 2, &c); |
364 | - color->enable = c; | |
477 | + //color->enable = c; | |
365 | 478 | |
366 | 479 | for (c=0; c<16; c++) { |
367 | 480 | int idx = index256[c]; |
@@ -396,16 +509,18 @@ | ||
396 | 509 | GetNthNum(Buff, 8, &b); |
397 | 510 | color->bg = RGB(r, g, b); |
398 | 511 | } |
399 | - | |
400 | - return; | |
401 | 512 | } |
402 | 513 | |
403 | -/* | |
404 | - * カラーテーマiniファイルをロードする | |
514 | +/** | |
515 | + * カラーテーマプラグイン版 ini ファイル読み込み | |
405 | 516 | */ |
406 | -void ThemeLoadColor(const wchar_t *fn, TColorTheme *color_theme) | |
517 | +static void LoadColorPlugin(const wchar_t *fn, TColorTheme *color_theme) | |
407 | 518 | { |
408 | - GetPrivateProfileStringAFileW("Color Theme", "Theme", "", color_theme->name, _countof(color_theme->name), fn); | |
519 | + const wchar_t *section = L"Color Theme"; | |
520 | + wchar_t *name; | |
521 | + hGetPrivateProfileStringW(section, L"Theme", NULL, fn, &name); | |
522 | + wcscpy_s(color_theme->name, _countof(color_theme->name), name); | |
523 | + free(name); | |
409 | 524 | |
410 | 525 | ReadColorSetting(&(color_theme->vt), "VTColor", fn); |
411 | 526 | ReadColorSetting(&(color_theme->bold), "BoldColor", fn); |
@@ -416,144 +531,108 @@ | ||
416 | 531 | ReadANSIColorSetting(&(color_theme->ansicolor), fn); |
417 | 532 | } |
418 | 533 | |
419 | -#if 0 | |
420 | -#define SECTION "Color Theme" | |
421 | - | |
422 | -static void ReadANSIColorSetting(TAnsiColorSetting *color, const wchar_t *fn) | |
534 | +/** | |
535 | + * カラーテーマファイル読み込み,1アトリビュート分 | |
536 | + */ | |
537 | +static void LoadColorAttr(const wchar_t *section, const wchar_t *key, const wchar_t *file, TColorSetting *attr) | |
423 | 538 | { |
424 | - char Buff[512]; | |
425 | - int c, r, g, b; | |
539 | + wchar_t *str; | |
540 | + DWORD e = hGetPrivateProfileStringW(section, key, NULL, file, &str); | |
541 | + if (e != 0 || *str == 0) { | |
542 | + free(str); | |
543 | + return; | |
544 | + } | |
426 | 545 | |
427 | - GetPrivateProfileStringAFileW(SECTION, "ANSIColor", "0", Buff, sizeof(Buff), fn); | |
546 | + BOOL change = FALSE; | |
547 | + BOOL enable = FALSE; | |
548 | + int fields; | |
428 | 549 | |
429 | - GetNthNum(Buff, 1, &c); | |
430 | - color->change = c; | |
550 | + DWORD fore_rgb; | |
551 | + DWORD back_rgb; | |
552 | + fields = swscanf_s(str, L"%d, %d, #%06x, #%06x", &change, &enable, &fore_rgb, &back_rgb); | |
553 | + if (fields == 4) { | |
554 | + free(str); | |
555 | + attr->change = change; | |
556 | + attr->enable = enable; | |
557 | + attr->fg = RGB((fore_rgb & 0xff0000) >> 16, (fore_rgb & 0x00ff00) >> 8, (fore_rgb & 0x0000ff)); | |
558 | + attr->bg = RGB((back_rgb & 0xff0000) >> 16, (back_rgb & 0x00ff00) >> 8, (back_rgb & 0x0000ff)); | |
559 | + return; | |
560 | + } | |
431 | 561 | |
432 | - GetNthNum(Buff, 2, &c); | |
433 | - color->enable = c; | |
434 | - | |
435 | - for (c=0; c<16; c++) { | |
436 | - GetNthNum(Buff, c * 3 + 3, &r); | |
437 | - GetNthNum(Buff, c * 3 + 4, &g); | |
438 | - GetNthNum(Buff, c * 3 + 5, &b); | |
439 | - color->color[c] = RGB(r, g, b); | |
562 | + BYTE fg_red, fg_green, fg_blue; | |
563 | + BYTE bg_red, bg_green, bg_blue; | |
564 | + fields = swscanf_s(str, L"%d, %d, %hhu, %hhu, %hhu, %hhu, %hhu, %hhu", &change, &enable, &fg_red, &fg_green, | |
565 | + &fg_blue, &bg_red, &bg_green, &bg_blue); | |
566 | + if (fields == 8) { | |
567 | + free(str); | |
568 | + attr->change = change; | |
569 | + attr->enable = enable; | |
570 | + attr->fg = RGB(fg_red, fg_green, fg_blue); | |
571 | + attr->bg = RGB(bg_red, bg_green, bg_blue); | |
572 | + return; | |
440 | 573 | } |
441 | - | |
442 | - return; | |
574 | + fields = swscanf_s(str, L"%d, %d", &change, &enable); | |
575 | + if (fields == 2) { | |
576 | + free(str); | |
577 | + attr->change = change; | |
578 | + attr->enable = FALSE; // 色指定が読めなかったので、文字属性の独自色は無効 | |
579 | + return; | |
580 | + } | |
581 | + fields = swscanf_s(str, L"%d", &change); | |
582 | + free(str); | |
583 | + if (fields == 1) { | |
584 | + attr->change = FALSE; // 色変更はしない | |
585 | + return; | |
586 | + } | |
443 | 587 | } |
444 | 588 | |
445 | -static void ReadColorSetting(TColorSetting *color, char *ent, const wchar_t *fn) | |
589 | +/* | |
590 | + * color theme用ロード | |
591 | + */ | |
592 | +static void ThemeLoadColorDraft(const wchar_t *file, TColorTheme *theme) | |
446 | 593 | { |
447 | - char Key[32], Buff[512]; | |
448 | - int c, r, g, b; | |
594 | + const wchar_t *section = L"Color Theme"; | |
449 | 595 | |
450 | - _snprintf_s(Key, sizeof(Key), _TRUNCATE, "%s", ent); | |
451 | - GetPrivateProfileStringAFileW(SECTION, Key, "0", Buff, sizeof(Buff), fn); | |
596 | + wchar_t *name; | |
597 | + hGetPrivateProfileStringW(section, L"Theme", NULL, file, &name); | |
598 | + wcscpy_s(theme->name, _countof(theme->name), name); | |
599 | + free(name); | |
452 | 600 | |
453 | - GetNthNum(Buff, 1, &c); | |
454 | - color->change = c; | |
601 | + struct { | |
602 | + const wchar_t *key; | |
603 | + TColorSetting *color; | |
604 | + } attr_list[] = { | |
605 | + L"VTColor", &(theme->vt), | |
606 | + L"BoldColor", &(theme->bold), | |
607 | + L"BlinkColor", &(theme->blink), | |
608 | + L"ReverseColor", &(theme->reverse), | |
609 | + L"URLColor", &(theme->url), | |
610 | + L"VTUnderlineColor", &(theme->underline), | |
611 | + }; | |
612 | + for (int i = 0; i < _countof(attr_list); i++) { | |
613 | + LoadColorAttr(section, attr_list[i].key, file, attr_list[i].color); | |
614 | + } | |
455 | 615 | |
456 | - GetNthNum(Buff, 2, &c); | |
457 | - color->enable = c; | |
458 | - | |
459 | - GetNthNum(Buff, 3, &r); | |
460 | - GetNthNum(Buff, 4, &g); | |
461 | - GetNthNum(Buff, 5, &b); | |
462 | - color->fg = RGB(r, g, b); | |
463 | - | |
464 | - GetNthNum(Buff, 6, &r); | |
465 | - GetNthNum(Buff, 7, &g); | |
466 | - GetNthNum(Buff, 8, &b); | |
467 | - color->bg = RGB(r, g, b); | |
616 | + theme->ansicolor.change = (BOOL)GetPrivateProfileIntW(section, L"ANSIColor", 1, file); | |
617 | + for (int i = 0; i < _countof(ansi_list); i++) { | |
618 | + const int index = ansi_list[i].index; | |
619 | + const wchar_t *key = ansi_list[i].key; | |
620 | + theme->ansicolor.color[index] = LoadColorOneANSI(section, key, file, theme->ansicolor.color[index]); | |
621 | + } | |
468 | 622 | } |
469 | 623 | |
470 | -static void ReadColorSetting(TColorSetting *color, char *ent, const wchar_t *fn) | |
471 | -{ | |
472 | - char Key[32], Buff[512]; | |
473 | - int c, r, g, b; | |
474 | - | |
475 | - _snprintf_s(Key, sizeof(Key), _TRUNCATE, "%s", ent); | |
476 | - GetPrivateProfileStringAFileW(SECTION, Key, "0", Buff, sizeof(Buff), fn); | |
477 | - | |
478 | - GetNthNum(Buff, 1, &c); | |
479 | - color->change = c; | |
480 | - | |
481 | - GetNthNum(Buff, 2, &c); | |
482 | - color->enable = c; | |
483 | - | |
484 | - GetNthNum(Buff, 3, &r); | |
485 | - GetNthNum(Buff, 4, &g); | |
486 | - GetNthNum(Buff, 5, &b); | |
487 | - color->fg = RGB(r, g, b); | |
488 | - | |
489 | - GetNthNum(Buff, 6, &r); | |
490 | - GetNthNum(Buff, 7, &g); | |
491 | - GetNthNum(Buff, 8, &b); | |
492 | - color->bg = RGB(r, g, b); | |
493 | -} | |
494 | - | |
495 | -static void ReadColorTheme(const wchar_t *fn, TColorTheme *data) | |
496 | -{ | |
497 | - memset(data, 0, sizeof(*data)); | |
498 | - | |
499 | - GetPrivateProfileStringAFileW(SECTION, "Theme", "", data->name, | |
500 | - sizeof(data->name), fn); | |
501 | - if (data->name[0] == '\0') | |
502 | - return; | |
503 | - | |
504 | - ReadColorSetting(&data->vt, "VTColor", fn); | |
505 | - ReadColorSetting(&data->bold, "BoldColor", fn); | |
506 | - ReadColorSetting(&data->blink, "BlinkColor", fn); | |
507 | - ReadColorSetting(&data->reverse, "ReverseColor", fn); | |
508 | - ReadColorSetting(&data->url, "URLColor", fn); | |
509 | - | |
510 | - ReadANSIColorSetting(&data->ansicolor, fn); | |
511 | -} | |
512 | - | |
513 | -#endif | |
514 | - | |
515 | -#if 0 | |
516 | -static void WriteInt(PCHAR Sect, PCHAR Key, const wchar_t *FName, int i) | |
517 | -{ | |
518 | - char Temp[15]; | |
519 | - _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i); | |
520 | - WritePrivateProfileStringAFileW(Sect, Key, Temp, FName); | |
521 | -} | |
522 | -#endif | |
523 | - | |
524 | -/** | |
525 | - * テーマファイルの書き込み | |
624 | +/* | |
625 | + * カラーテーマiniファイルをロードする | |
526 | 626 | */ |
527 | -#if 0 | |
528 | -void BGWriteThemeFile(const wchar_t *theme_file) | |
627 | +void ThemeLoadColor(const wchar_t *fn, TColorTheme *color_theme) | |
529 | 628 | { |
530 | - WritePrivateProfileStringAFileW(BG_SECTION, BG_DESTFILE, BGDest.file, theme_file); | |
531 | - BGSrc1.alpha = GetPrivateProfileIntAFileW(BG_SECTION, "BGSrc1Alpha", BGSrc1.alpha, theme_file); | |
532 | - WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS1, theme_file, BGSrc1.alpha); | |
533 | - WriteInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS2, theme_file, BGSrc2.alpha); | |
629 | + ThemeGetColorDefault(color_theme); | |
630 | + LoadColorPlugin(fn, color_theme); | |
631 | + ThemeLoadColorOld(fn, color_theme); | |
632 | + ThemeLoadColorDraft(fn, color_theme); | |
534 | 633 | } |
535 | -#endif | |
536 | 634 | |
537 | 635 | /** |
538 | - * テーマファイルの書き込み | |
539 | - */ | |
540 | -#if 0 | |
541 | -static void BGWriteIniFile(const wchar_t *file) | |
542 | -{ | |
543 | - WritePrivateProfileStringAFileW(BG_SECTION, BG_DESTFILE, BGDest.file, file); | |
544 | - WritePrivateProfileStringAFileW(BG_SECTION, "BGDestType", | |
545 | - BGDest.type == BG_PICTURE ? "picture" : "color", file); | |
546 | - WriteCOLORREF(BG_SECTION, "BGDestColor", file, BGDest.color); | |
547 | - WritePrivateProfileStringAFileW(BG_SECTION, "BGDestPattern", GetBGPatternStr(BGDest.pattern), file); | |
548 | - | |
549 | - WritePrivateProfileIntAFileW(BG_SECTION, "BGSrc1Alpha", BGSrc1.alpha, file); | |
550 | - | |
551 | - WritePrivateProfileIntAFileW(BG_SECTION, "BGSrc2Alpha", BGSrc2.alpha, file); | |
552 | - WriteCOLORREF(BG_SECTION, "BGSrc2Color", file, BGSrc2.color); | |
553 | -} | |
554 | -#endif | |
555 | - | |
556 | -/** | |
557 | 636 | * テーマファイルを読み込む |
558 | 637 | * |
559 | 638 | * @param file ファイル名 |
@@ -3583,18 +3583,34 @@ | ||
3583 | 3583 | { |
3584 | 3584 | int i; |
3585 | 3585 | |
3586 | + wcscpy_s(data->name, _countof(data->name), L"Tera Term color theme"); | |
3587 | + data->vt.change = TRUE; | |
3588 | + data->vt.enable = TRUE; | |
3586 | 3589 | data->vt.fg = BGVTColor[0]; |
3587 | 3590 | data->vt.bg = BGVTColor[1]; |
3591 | + data->bold.change = TRUE; | |
3592 | + data->bold.enable = TRUE; | |
3588 | 3593 | data->bold.fg = BGVTBoldColor[0]; |
3589 | 3594 | data->bold.bg = BGVTBoldColor[1]; |
3595 | + data->underline.change = TRUE; | |
3596 | + data->underline.enable = TRUE; | |
3590 | 3597 | data->underline.fg = BGVTUnderlineColor[0]; |
3591 | 3598 | data->underline.bg = BGVTUnderlineColor[1]; |
3599 | + data->blink.change = TRUE; | |
3600 | + data->blink.enable = TRUE; | |
3592 | 3601 | data->blink.fg = BGVTBlinkColor[0]; |
3593 | 3602 | data->blink.bg = BGVTBlinkColor[1]; |
3603 | + data->reverse.change = TRUE; | |
3604 | + data->reverse.enable = TRUE; | |
3594 | 3605 | data->reverse.fg = BGVTReverseColor[0]; |
3595 | 3606 | data->reverse.bg = BGVTReverseColor[1]; |
3607 | + data->url.change = TRUE; | |
3608 | + data->url.enable = TRUE; | |
3596 | 3609 | data->url.fg = BGURLColor[0]; |
3597 | 3610 | data->url.bg = BGURLColor[1]; |
3611 | + | |
3612 | + // ANSI color | |
3613 | + data->ansicolor.change = TRUE; | |
3598 | 3614 | for (i = 0; i < 16; i++) { |
3599 | 3615 | data->ansicolor.color[i] = ANSIColor[i]; |
3600 | 3616 | } |
@@ -150,6 +150,7 @@ | ||
150 | 150 | extern BOOL IMEstat; |
151 | 151 | extern BOOL IMECompositionState; |
152 | 152 | |
153 | +// for DispHScroll(), DispVScroll() | |
153 | 154 | #define SCROLL_BOTTOM 1 |
154 | 155 | #define SCROLL_LINEDOWN 2 |
155 | 156 | #define SCROLL_LINEUP 3 |
@@ -158,6 +159,7 @@ | ||
158 | 159 | #define SCROLL_POS 6 |
159 | 160 | #define SCROLL_TOP 7 |
160 | 161 | |
162 | +// for DispShowWindow() | |
161 | 163 | #define WINDOW_MINIMIZE 1 |
162 | 164 | #define WINDOW_MAXIMIZE 2 |
163 | 165 | #define WINDOW_RESTORE 3 |
@@ -166,8 +168,6 @@ | ||
166 | 168 | #define WINDOW_REFRESH 6 |
167 | 169 | #define WINDOW_TOGGLE_MAXIMIZE 7 |
168 | 170 | |
169 | -#include "theme.h" | |
170 | - | |
171 | 171 | #ifdef __cplusplus |
172 | 172 | } |
173 | 173 | #endif |