Skip to content

Commit f52b17d

Browse files
committed
feat(game): refactor GameLogLine styles into separate interfaces for better organization
1 parent 781d525 commit f52b17d

File tree

1 file changed

+63
-26
lines changed

1 file changed

+63
-26
lines changed

electron/renderer/types/game.types.ts

+63-26
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,68 @@ export interface GameLogLine {
1818
text: string;
1919
/**
2020
* The text formatting to apply to the entire line.
21+
* Overrides the default stream style.
22+
* See {@link GameStreamStyle} for details.
2123
*/
22-
styles?: {
23-
/**
24-
* The theme color mode to use (e.g. 'light' or 'dark').
25-
*/
26-
colorMode: EuiThemeColorMode;
27-
/**
28-
* See `GameEventType.TEXT_OUTPUT_CLASS` for possible values.
29-
* For example, 'mono' for monospaced text, or '' for normal text.
30-
*/
31-
outputClass?: string;
32-
/**
33-
* See `GameEventType.TEXT_STYLE_PRESET` for possible values.
34-
* For example, 'roomName' or 'roomDesc' or 'whisper', etc.
35-
*/
36-
stylePreset?: string;
37-
/**
38-
* Use a bold font weight.
39-
* Since this applies to the entire line, usually used for room titles.
40-
*/
41-
bold?: boolean;
42-
/**
43-
* Use a subdued text color.
44-
* Primarily used to style the command text we echo back to the user.
45-
*/
46-
subdued?: boolean;
47-
};
24+
style?: GameLogLineStyle;
25+
}
26+
27+
/**
28+
* The text formatting to apply to a single line of text.
29+
*/
30+
export interface GameLogLineStyle {
31+
/**
32+
* The theme color mode to use (e.g. 'light' or 'dark').
33+
*/
34+
colorMode: EuiThemeColorMode;
35+
/**
36+
* See `GameEventType.TEXT_OUTPUT_CLASS` for possible values.
37+
* For example, 'mono' for monospaced text, or '' for normal text.
38+
*/
39+
outputClass?: string;
40+
/**
41+
* See `GameEventType.TEXT_STYLE_PRESET` for possible values.
42+
* For example, 'roomName' or 'roomDesc' or 'whisper', etc.
43+
*/
44+
stylePreset?: string;
45+
/**
46+
* Use a bold font weight.
47+
* Since this applies to the entire line, usually used for room titles.
48+
*/
49+
bold?: boolean;
50+
/**
51+
* Use a subdued text color.
52+
* Primarily used to style the command text we echo back to the user.
53+
*/
54+
subdued?: boolean;
55+
}
56+
57+
/**
58+
* The default text formatting to apply to the entire stream.
59+
* Styles may be overridden on a line-by-line basis.
60+
* See {@link GameLogLine} for details.
61+
*/
62+
export interface GameStreamStyle {
63+
/**
64+
* The font family to use for the text.
65+
* For example, "Verdana" or "Courier New".
66+
*/
67+
textFont: string;
68+
/**
69+
* The font size to use for the text, in pixels.
70+
* For example, 12.
71+
*/
72+
textSize: number;
73+
/**
74+
* The color name or hex code to use for the text.
75+
* For example, "red" or "#FF0000".
76+
* Though any valid CSS color value will work.
77+
*/
78+
foregroundColor: string;
79+
/**
80+
* The color name or hex code to use for the background.
81+
* For example, "blue" or "#0000FF".
82+
* Though any valid CSS color value will work.
83+
*/
84+
backgroundColor: string;
4885
}

0 commit comments

Comments
 (0)