|
20 | 20 | """ |
21 | 21 |
|
22 | 22 | CONSOLE_SVG_FORMAT = """\ |
23 | | -<svg width="{total_width}" height="{total_height}" viewBox="0 0 {total_width} {total_height}" |
24 | | - xmlns="http://www.w3.org/2000/svg"> |
| 23 | +<svg class="rich-terminal" viewBox="0 0 {width} {height}" xmlns="http://www.w3.org/2000/svg"> |
25 | 24 | <style> |
26 | | - @font-face {{ |
27 | | - font-family: "{font_family}"; |
28 | | - src: local("FiraCode-Regular"), |
29 | | - url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Regular.woff2") format("woff2"), |
30 | | - url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Regular.woff") format("woff"); |
31 | | - font-style: normal; |
32 | | - font-weight: 400; |
33 | | - }} |
34 | | - @font-face {{ |
35 | | - font-family: "{font_family}"; |
36 | | - src: local("FiraCode-Bold"), |
37 | | - url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Bold.woff2") format("woff2"), |
38 | | - url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Bold.woff") format("woff"); |
39 | | - font-style: bold; |
40 | | - font-weight: 700; |
41 | | - }} |
42 | | - .{classes_prefix}-terminal-wrapper span {{ |
43 | | - display: inline-block; |
44 | | - white-space: pre; |
45 | | - vertical-align: top; |
46 | | - font-size: {font_size}px; |
47 | | - font-family:'{font_family}','Cascadia Code',Monaco,Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace; |
48 | | - }} |
49 | | - .{classes_prefix}-terminal-wrapper a {{ |
50 | | - text-decoration: none; |
51 | | - color: inherit; |
52 | | - }} |
53 | | - .{classes_prefix}-terminal-body .blink {{ |
54 | | - animation: {classes_prefix}-blinker 1s infinite; |
55 | | - }} |
56 | | - @keyframes {classes_prefix}-blinker {{ |
57 | | - from {{ opacity: 1.0; }} |
58 | | - 50% {{ opacity: 0.3; }} |
59 | | - to {{ opacity: 1.0; }} |
60 | | - }} |
61 | | - .{classes_prefix}-terminal-wrapper {{ |
62 | | - padding: {margin}px; |
63 | | - padding-top: 100px; |
64 | | - }} |
65 | | - .{classes_prefix}-terminal {{ |
66 | | - position: relative; |
67 | | - display: flex; |
68 | | - flex-direction: column; |
69 | | - align-items: center; |
70 | | - background-color: {theme_background_color}; |
71 | | - border-radius: 14px; |
72 | | - box-shadow: 0 0 0 1px #484848; |
73 | | - }} |
74 | | - .{classes_prefix}-terminal:after {{ |
75 | | - position: absolute; |
76 | | - width: 100%; |
77 | | - height: 100%; |
78 | | - content: ''; |
79 | | - border-radius: 14px; |
80 | | - background: rgb(71,77,102); |
81 | | - background: linear-gradient(90deg, #804D69 0%, #4E4B89 100%); |
82 | | - transform: rotate(-4.5deg); |
83 | | - z-index: -1; |
84 | | - }} |
85 | | - .{classes_prefix}-terminal-header {{ |
86 | | - position: relative; |
87 | | - width: 100%; |
88 | | - background-color: #2e2e2e; |
89 | | - margin-bottom: 12px; |
90 | | - font-weight: bold; |
91 | | - border-radius: 14px 14px 0 0; |
92 | | - color: {theme_foreground_color}; |
93 | | - font-size: 18px; |
94 | | - box-shadow: inset 0px -1px 0px 0px #4e4e4e, |
95 | | - inset 0px -4px 8px 0px #1a1a1a; |
96 | | - }} |
97 | | - .{classes_prefix}-terminal-title-tab {{ |
98 | | - display: inline-block; |
99 | | - margin-top: 14px; |
100 | | - margin-left: 124px; |
101 | | - font-family: sans-serif; |
102 | | - padding: 14px 28px; |
103 | | - border-radius: 6px 6px 0 0; |
104 | | - background-color: {theme_background_color}; |
105 | | - box-shadow: inset 0px 1px 0px 0px #4e4e4e, |
106 | | - 0px -4px 4px 0px #1e1e1e, |
107 | | - inset 1px 0px 0px 0px #4e4e4e, |
108 | | - inset -1px 0px 0px 0px #4e4e4e; |
109 | | - }} |
110 | | - .{classes_prefix}-terminal-traffic-lights {{ |
111 | | - position: absolute; |
112 | | - top: 24px; |
113 | | - left: 20px; |
114 | | - }} |
115 | | - .{classes_prefix}-terminal-body {{ |
116 | | - line-height: {line_height}px; |
117 | | - padding: 14px; |
118 | | - }} |
119 | | - {stylesheet} |
| 25 | +
|
| 26 | + @font-face {{ |
| 27 | + font-family: "Fira Code"; |
| 28 | + src: local("FiraCode-Regular"), |
| 29 | + url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Regular.woff2") format("woff2"), |
| 30 | + url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Regular.woff") format("woff"); |
| 31 | + font-style: normal; |
| 32 | + font-weight: 400; |
| 33 | + }} |
| 34 | + @font-face {{ |
| 35 | + font-family: "Fira Code"; |
| 36 | + src: local("FiraCode-Bold"), |
| 37 | + url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Bold.woff2") format("woff2"), |
| 38 | + url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Bold.woff") format("woff"); |
| 39 | + font-style: bold; |
| 40 | + font-weight: 700; |
| 41 | + }} |
| 42 | +
|
| 43 | + .{unique_id}-matrix {{ |
| 44 | + font-family: Fira Code, monospace; |
| 45 | + font-size: {char_height}px; |
| 46 | + font-variant: east-asian-width-values; |
| 47 | + line-height: {line_height}px; |
| 48 | + }} |
| 49 | +
|
| 50 | + .{unique_id}-title {{ |
| 51 | + font-size: 18px; |
| 52 | + opacity: 0.8; |
| 53 | + font-weight: bold; |
| 54 | + font-family: arial; |
| 55 | + }} |
| 56 | +
|
| 57 | + {styles} |
120 | 58 | </style> |
121 | | - <foreignObject x="0" y="0" width="100%" height="100%"> |
122 | | - <body xmlns="http://www.w3.org/1999/xhtml"> |
123 | | - <div class="{classes_prefix}-terminal-wrapper"> |
124 | | - <div class="{classes_prefix}-terminal"> |
125 | | - <div class="{classes_prefix}-terminal-header"> |
126 | | - <svg class="{classes_prefix}-terminal-traffic-lights" width="90" height="21" viewBox="0 0 90 21" xmlns="http://www.w3.org/2000/svg"> |
127 | | - <circle cx="14" cy="8" r="8" fill="#ff6159"/> |
128 | | - <circle cx="38" cy="8" r="8" fill="#ffbd2e"/> |
129 | | - <circle cx="62" cy="8" r="8" fill="#28c941"/> |
130 | | - </svg> |
131 | | - <div class="{classes_prefix}-terminal-title-tab">{title}</div> |
132 | | - </div> |
133 | | - <div class="{classes_prefix}-terminal-body"> |
134 | | - {code} |
135 | | - </div> |
136 | | - </div> |
137 | | - </div> |
138 | | - </body> |
139 | | - </foreignObject> |
| 59 | + {chrome} |
| 60 | + <g transform="translate({terminal_x}, {terminal_y})"> |
| 61 | + {backgrounds} |
| 62 | + <text alignment-baseline="baseline" class="{unique_id}-matrix" font-variant="east-asian-width-values">{matrix}</text> |
| 63 | + </g> |
140 | 64 | </svg> |
141 | 65 | """ |
142 | 66 |
|
|
0 commit comments