aboutsummaryrefslogtreecommitdiff
path: root/build/soma-terminal-css/index.html
blob: 4da2c50a931edd79ec32ddd733aa51673c14dd0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="color-scheme" content="dark light">
	<link rel="icon" href="data:,">
	<title>SOMA Inspired Terminal Display with CSS</title>
	<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
	<link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>

<nav>
	<a href="#menu">Menu &darr;</a>
</nav>

<main>
<h1 id="soma-inspired-terminal-display-with-css">SOMA Inspired Terminal Display with CSS</h1>
<p>2021-05-29</p>
<p>A few years back I played (and loved) <a href="https://store.steampowered.com/app/282140/SOMA/">SOMA</a>, a first-person sci-fi horror-adventure game. The story was intriguing and the developers nailed the overall atmosphere of Pathos-II. Though both those aspects were great, what I found the most enjoyable were the interactive computers and displays found sprinkled throughout the world.</p>
<p>Three years ago I wanted to see if I could recreate one of those terminal displays with HTML &#38; CSS. And I did just that.</p>
<p>So, why am I writing about this <em>three years later</em>? Well, I never did a proper write-up explaining how I achieved it. I&#8217;m sure someone out there in the wild west of the web could get some value out of this tutorial, right? I hope so!</p>
<h2 id="the-live-demo">The Live Demo</h2>
<p><img src="/public/images/soma-terminal.png" alt="Terminal based off the SOMA computers" /></p>
<p><a href="https://codepen.io/bradleytaunt/pen/ZEeLgmz">Live CodePen Example</a></p>
<h2 id="the-html">The HTML</h2>
<p>Nothing fancy going on here - just some simple <code>div</code> elements holding a few paragraphs and spans:</p>
<pre><code>&#60;div class="outer-frame"&#62;
    &#60;div class="screen"&#62;
        &#60;div class="screen-guts"&#62;
            &#60;h2&#62;Key Control&#60;&#47;h2&#62;
            &#60;p&#62;&#60;span&#62;Panel Chip&#60;&#47;span&#62; (Connector)&#60;&#47;p&#62;
            &#60;p class="column"&#62;
                Security Keys: 023-027&#60;br&#62;C819738-23
                &#60;br&#62;
                &#60;span class="error"&#62;Error: Key Expired&#60;&#47;span&#62;
                &#60;br&#62;
                &#60;em&#62;Please update...&#60;&#47;em&#62;
            &#60;&#47;p&#62;
            &#60;p&#62;
                &#60;span&#62;Permission&#60;&#47;span&#62;
                &#60;br&#62;
                Standard ThetaCipher
                &#60;br&#62;
                &#60;span&#62;Secop-Jstrohweier&#60;&#47;span&#62;
            &#60;&#47;p&#62;
            &#60;button class="update-button"&#62;Update Chip&#60;&#47;button&#62;
        &#60;&#47;div&#62;
        &#60;div class="bottom-controls"&#62;
            &#60;button class="back-button"&#62;Back 背部&#60;&#47;button&#62;
        &#60;&#47;div&#62;
    &#60;&#47;div&#62;
&#60;&#47;div&#62;
</code></pre>
<h2 id="the-css">The CSS</h2>
<p>Let&#8217;s just dump all the CSS right here (don&#8217;t worry, it looks far more complicated than it really is):</p>
<pre><code>@import url(&#39;https:&#47;&#47;opentype.netlify.com&#47;sansation&#47;index.css&#39;);

* {
    box-sizing: border-box;
}

body {
    background: #333;
    font-family: "Sansation", sans-serif;
    padding: 3rem 0;
}

button {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-family: "Inconsolata", "Consolas", mono;
    font-size: 18px;
    transition: 0.3s ease all;
}

.outer-frame,
.screen {
    display: block;
    margin: 0 auto;
    position: relative;
}

.outer-frame {
    background: #ccc url("https:&#47;&#47;preview.ibb.co&#47;iS9nz7&#47;screen_grunge.webp") no-repeat center;
    background-size: cover;
    border-radius: 5px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.6);
    height: 560px;
    width: 750px;
}
.outer-frame:before {
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    box-shadow: inset 5px 5px 10px rgba(0,0,0,0.4), 1px 1px 1px rgba(255,255,255,0.3);
    content: &#39;&#39;;
    height: 538px;
    left: 15px;
    position: absolute;
    top: 11px;
    width: 720px;
}

.screen {
    background: #000 url("https:&#47;&#47;image.ibb.co&#47;gOqSz7&#47;screen_dust.webp") no-repeat center;
    background-size: cover;
    border-radius: 5px;
    height: 450px;
    left: 75px;
    padding: 60px;
    position: absolute;
    top: 55px;
    width: 600px;
}
.screen:after {
    background: url("https:&#47;&#47;s13.postimg.org&#47;85ryuy1o7&#47;dust.webp") no-repeat center;
    background-size: cover;
    border-radius: 5px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), inset 5px 5px 10px rgba(0,0,0,0.4), 1px 1px 1px rgba(255,255,255,0.3);
    content: &#39;&#39;;
    height: 100%;
    left: 0;
    opacity: 0.8;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 2;
}

.screen-guts {
    border-bottom: 2px solid #8fc8c8;
    border-top: 2px solid #8fc8c8;
    height: calc(100% - 50px);
    position: relative;
    width: 100%;
    z-index: 0;
}
.screen-guts:after {
    border: 2px solid #8fc8c8;
    color: #8fc8c8;
    content: &#39;键&#39;;
    padding: 5px 8px;
    position: absolute;
    right: 0;
    top: 5px;
}
.screen-guts h2 {
    background: #8fc8c8;
    color: #fff;
    display: inline-block;
    font-size: 24px;
    margin: 0 0 30px 0;
    padding: 10px;
}
.screen-guts p {
    color: #8fc8c8;
    font-size: 18px;
    margin: 0 0 30px 0;
}
.screen-guts p.column {
    column-width: 200px;
}
.screen-guts p span {
    text-transform: uppercase;
}
.screen-guts p span.error {
    color: #f37c56;
}
.screen-guts p span em {
    text-transform: none;
}
.screen-guts button.update-button {
    background: #889314;
    bottom: 10px;
    color: #fff;
    padding: 15px 20px;
    position: absolute;
    right: 0;
}
.screen-guts button.update-button:hover {
    background: #515905;
}

.bottom-controls {
    background: #8fc8c8;
    border-radius: 0 0 5px 5px;
    bottom: 0;
    display: flex;
    left: 0;
    height: 50px;
    padding: 5px;
    position: absolute;
    width: 100%;
}
.bottom-controls button.back-button {
    background: rgba(0,0,0,0.2);
    color: #fff;
    line-height: 20px;
    padding: 8px 20px;
    text-transform: uppercase;
}
.bottom-controls button.back-button:hover {
    background: rgba(0,0,0,0.6);
}
</code></pre>
<p>The overall styling is fairly simple (which is great for browser support) with only a couple pseudo elements. It&#8217;s important to include the custom <code>Sansation</code> typeface, since this is what the game uses for most UI elements and terminals. (I&#8217;m loading in this font via my <a href="https://opentype.netlify.app">OpenType side project</a>)</p>
<p>The most important properties that truly bring this design together are those associated with the <code>.outer-frame</code> and <code>.screen</code> pseudo elements. Both of these elements use custom <code>background-images</code> that give a little more depth and life to the terminal - in this case fingerprints, dust and smudges.</p>
<p>Feel free to swap these image textures out with your own and alter the terminal as you see fit!</p>
<footer role="contentinfo">
    <h2>Menu Navigation</h2>
    <ul id="menu">
        <li><a href="/">Home</a></li>
        <li><a href="/projects">Projects</a></li>
        <li><a href="/uses">Uses</a></li>
        <li><a href="/wiki">Wiki</a></li>
        <li><a href="/resume">Resume</a></li>
        <li><a href="/colophon">Colophon</a></li>
        <li><a href="/now">Now</a></li>
        <li><a href="/donate">Donate</a></li>
        <li><a href="/atom.xml">RSS</a></li>
        <li><a href="#top">&uarr; Top of the page</a></li>
    </ul>
    <small>
        Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br>
        Maintained with ♥ for the web. <br>
        Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> &amp; <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br>
        The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>.
    </small>
</footer>