Appearance
2.9.5 — Desktop Interfaces & Text Formats
The photo-upload service's admin page is a web page, styled with CSS (6.2.2). A designer on the team asks a fair question: when Microsoft redesigned Windows 10 into Windows 11, with rounded corners and frosted-glass panels, did they rewrite a giant CSS file? And while we are asking: a caption saved in Notepad cannot be bold, but the same words in WordPad can. Where does the "bold" go?
Both questions are about the same thing: what the operating system draws, and what a file actually contains. They make a fitting end to Part 2, because both answers rest on ideas from earlier pages: processes and the GPU's memory for the first, bytes and their meaning for the second.
1. A design language: the rules for how things look
When people say Windows 11 "looks different" from Windows 10, they mean its design language changed. A design language is a written set of rules for how everything in a system looks and behaves:
- the shapes, such as how rounded the corners are;
- spacing and alignment;
- fonts and icon style;
- colours, light and dark themes;
- motion, such as how a window opens;
- and materials, such as translucent, blurred backgrounds.
Following one design language is what makes every built-in app, and well-made third-party apps, feel like one system.
- Microsoft's is called Fluent Design, introduced in 2017. Windows 11's rounded corners and its tinted, softly blurred window backgrounds are Fluent.
- Apple publishes its rules as the Human Interface Guidelines. Mac OS X's original look, from 2001, was called Aqua, after its glossy, water-like buttons. In 2025 Apple introduced a new look across all its systems called Liquid Glass.
A redesign like Windows 10 to 11 is mostly a new design language, applied by updating the shared building blocks that every app draws its buttons and windows with. That is the next section.
2. How a desktop app draws, if not with CSS
Web pages are described in HTML and styled with CSS, and a browser engine turns those into pixels (6.1.2). Desktop apps usually do not use a browser at all. They are built with a native UI toolkit: a library supplied by the operating system that provides ready-made buttons, menus, text boxes and windows, already following the system's design language.
| System | Toolkits, oldest to newest |
|---|---|
| Windows | Win32 (1985), WPF (2006), WinUI (current) |
| macOS | AppKit (from NeXT, 1980s), SwiftUI (2019) |
A program asks the toolkit for "a button labelled Upload". The toolkit knows exactly how a button should look on this version of the system, draws it, and handles clicks and keyboard focus. That is why, when Microsoft updates the toolkit's look, apps built on it change appearance without being rewritten.
From each app's window to the screen
Underneath, every system now works the same way, and it uses ideas from this Part.
- Each app draws its window into its own off-screen buffer, a block of memory, usually on the graphics processor.
- A system program called the window compositor takes every app's buffer and combines them into the final picture on the screen, adding shadows, transparency and animations as it goes. On Windows the compositor is the Desktop Window Manager,
dwm.exe, in every version since Windows Vista in 2007. On macOS it is part of a process called WindowServer.
Because the compositor keeps each window's last picture, a frozen app does not leave a hole on the screen: its last image stays, and Windows can dim it and add "(Not Responding)" (2.9.2). The blurred glass behind Windows 11 panels, and Liquid Glass on Apple systems, are effects the compositor applies when it combines the windows. They are not drawn by the app at all.
The web way: Electron and its relatives
Some desktop apps do use web technology. Electron, first released in 2013, bundles a complete copy of the Chromium browser engine and Node into each app, so the app's whole interface is HTML, CSS and JavaScript. VS Code, Slack and many others are built this way. The benefit is one codebase for Windows, macOS and Linux, written by web developers. The cost is that every such app carries a whole browser: more memory, a larger download, slower start-up, and controls that only imitate the native ones. Newer frameworks reduce the cost by using the browser engine already built into the operating system instead of shipping their own.
So the honest answer to the designer is: native Windows and macOS apps are styled by their native toolkits and the system's design language, not by CSS. But the line is blurring, as some apps are web pages in a window and the native toolkits borrow more and more ideas from the web. ⚑What is a design language of an OS? Windows 10→11, macOS — they don't use CSS, so what? [EQ-36]
3. Plain text and rich text: where the bold goes
Now the second question. Here is the photo caption saved two ways.
ts
// caption-files.ts — the same photo caption as plain text and as rich text
import { writeFileSync, readFileSync, statSync } from "node:fs";
writeFileSync("caption.txt", "Sunset at Goa beach"); // (1)
writeFileSync("caption.rtf", "{\\rtf1\\ansi Sunset at {\\b Goa} beach}"); // (2)
for (const f of ["caption.txt", "caption.rtf"]) {
console.log(`${f}: ${statSync(f).size} bytes ->`, JSON.stringify(readFileSync(f, "utf8"))); // (3)
}
// Prints:
// caption.txt: 19 bytes -> "Sunset at Goa beach"
// caption.rtf: 37 bytes -> "{\\rtf1\\ansi Sunset at {\\b Goa} beach}"(1)The plain-text file holds exactly the 19 characters of the caption, and nothing else.(2)The RTF file holds the same words, plus extra instructions.{\rtf1\ansimeans "this is Rich Text Format, version 1".{\b Goa}means "the word Goa, in bold". In TypeScript each backslash has to be written twice inside a string, but the file contains single backslashes.(3)Reading both back shows the difference directly. Opencaption.rtfin WordPad or Word, and "Goa" appears in bold.
A plain text file, such as a .txt file, contains only the codes of the characters: the letters as bytes, in an encoding such as UTF-8 (1.4). There is no font, no size, no colour and no bold, because there is simply nowhere in the file to say "this word is bold". The file is the characters. That is its strength: any program on any system, now or in fifty years, can read it, and it is exactly what source code, configuration files and logs should be.
Rich text gets its styling by storing formatting instructions alongside the characters. Each format does it its own way:
| Format | How "bold" is stored |
|---|---|
| RTF (1987) | control words in the text: {\b Goa} |
| HTML | tags around the text: <b>Goa</b> |
| Markdown | symbols around the text: **Goa** |
Word .docx | a zip file of XML files describing text and styles |
A .docx file is worth one more sentence. Rename one to .zip and open it, and you will find a folder of XML files: one with the text and its formatting, others with styles, images and settings. That is why a nearly empty Word document is several kilobytes, while the same words in a .txt file are a few bytes.
The lesson is the one from 1.4: bytes mean whatever the writer and the reader agree they mean. A .txt and an .rtf can hold the same words. The .rtf also carries instructions, and a program that understands RTF knows how to apply them. A program that does not, such as Notepad, simply shows the instructions as text.
And Notepad?
For most of its life, Notepad could only edit plain text, which is exactly why programmers loved it: no hidden formatting could sneak into code. In 2025, Microsoft began adding simple formatting, such as bold and headings, to Notepad on Windows 11. It stores that formatting as Markdown, the symbol-based format in the table above. So the file stays plain text that any program can read: bold is just ** characters around a word, which Notepad chooses to display as bold. Markdown is also the format this book is written in. ⚑How did Notepad/.txt gain rich text? How can a plain .txt capture styling? [EQ-200]
4. Part 2, looking back
This Part began with a laptop running four programs that could not see each other's memory, and asked who was enforcing that. Every page since has added one piece of the answer:
- the kernel and the wall between user mode and kernel mode, crossed only by system calls;
- processes, created by fork and exec, told to stop by signals, talking through pipes and sockets;
- threads, and the scheduler that shares the cores fairly among them;
- atomic instructions and locks, and the deadlocks they can cause;
- virtual memory, page tables, page faults and allocators;
- file systems: inodes, journals,
fsyncand the VFS; - I/O: interrupts, DMA,
epoll, IOPS and backpressure; - and the tools to see all of it on a real Linux machine, and the same ideas under other names on Windows and macOS.
Through all of it, the photo-upload service was the same program, and every behaviour it showed, from losing uploads in a race to dying on a dropped ssh connection, came from one of those pieces. The names change between systems. The machine underneath does not. Containers, which wrap exactly these processes with namespaces and cgroups, are built step by step in 14.1.3.
What the interviewer will push on
"What is a design language, and how do desktop apps draw their interfaces?" They are checking whether you separate the rules from the machinery. A design language, such as Fluent or Apple's Human Interface Guidelines, defines how things look and behave. Native toolkits, such as WinUI, AppKit and SwiftUI, implement those rules for buttons and windows; a window compositor combines each app's buffer into the screen. Electron apps instead render HTML and CSS in a bundled browser engine.
"Why do Electron apps feel heavier than native apps?" Each one carries a full browser engine and Node runtime, costing memory, download size and start-up time, and its controls imitate the native ones rather than using them. The benefit is one codebase across systems.
"What is the difference between plain text and rich text?" Plain text stores only character codes, so it cannot express formatting; rich text stores formatting instructions alongside the characters, as RTF control words, HTML tags, Markdown symbols or Word's XML. The tell is explaining where the bold lives in the file.
"What is inside a .docx file?" A zip archive of XML files describing the text, styles, images and settings.
Something to volunteer that nobody asks for: the window compositor is why a frozen app's window still shows its last picture instead of a blank hole, and why effects like blurred glass cost the app nothing. It connects the "Not Responding" behaviour of 2.9.2 to how the screen is actually built.
Recall
- A design language is the set of rules for how a system looks and behaves: shapes, spacing, fonts, colour, motion, materials. Microsoft's is Fluent Design; Apple's are the Human Interface Guidelines, from Aqua to Liquid Glass.
- Native apps are built with a native UI toolkit (Win32, WPF and WinUI on Windows; AppKit and SwiftUI on macOS), not CSS, so updating the toolkit restyles the apps.
- Each app draws into its own off-screen buffer, and the window compositor (
dwm.exeon Windows, WindowServer on macOS) combines them, adding transparency and blur. - Electron apps bundle a browser engine and Node and draw with HTML and CSS: one codebase, at the cost of memory, size and native feel.
- Plain text holds only character codes; rich text adds formatting instructions: RTF
{\b …}, HTML tags, Markdown**…**, or a.docxzip of XML. Notepad's 2025 formatting is stored as Markdown, so the file stays plain text.
Self-test: What changed when Windows 10 became Windows 11, and what did not have to change in most apps? What does the window compositor do, and why does a frozen app's window not vanish? Why is an Electron app larger than a native one? Where, byte by byte, is "bold" stored in the RTF caption? Why can a .txt file never hold bold text, and how does Notepad's Markdown formatting get around that?
Quiz Bank
FoundationalWhat is an operating system's design language, and how is a native desktop interface drawn if not with CSS?
A design language is a consistent set of visual and interaction rules: shapes, spacing, fonts, colours, icons, motion and materials, such as Microsoft's Fluent Design or Apple's Human Interface Guidelines. Native applications are built with the system's native UI toolkit, such as WinUI on Windows or AppKit and SwiftUI on macOS, which provides standard controls that already follow the design language. Each application draws into its own buffer, and the system's window compositor combines all windows into the final screen image. CSS is a web technology and is used only by apps that embed a browser engine, such as Electron apps.
FoundationalWhat is the difference between plain text and rich text?
A plain text file, such as .txt, contains only the codes of its characters, in an encoding such as UTF-8, with nowhere to store fonts or styles, so any program can read it. Rich text adds formatting instructions alongside the characters: RTF uses control words such as {\b bold}, HTML uses tags such as <b>, Markdown uses symbols such as **bold**, and Word's .docx is a zip of XML files describing text and styles. A program that understands the format applies the instructions; one that does not shows them as text or cannot open the file.
AppliedWhat does a window compositor do?
Each application draws its window into its own off-screen buffer rather than directly onto the screen. The window compositor, dwm.exe on Windows and WindowServer on macOS, takes all those buffers and combines them into the final image, positioning windows, drawing shadows and applying effects such as transparency, blur and animation, usually on the graphics processor. Because it keeps each window's last image, a frozen application's window still shows its last contents, which the system can dim and mark as not responding.
InterviewWhy do cross-platform desktop apps built with Electron often feel less native and use more resources?
An Electron app bundles its own copy of the Chromium browser engine and the Node runtime, and draws its entire interface with HTML, CSS and JavaScript. So each app pays for a full browser in memory, download size and start-up time, and its controls imitate the system's native ones instead of using the native toolkit, so details of look, animation, keyboard behaviour and accessibility can differ. The benefit is a single codebase for Windows, macOS and Linux, written with web skills. Lighter alternatives use the operating system's built-in web engine instead of bundling one, and fully native or native cross-platform toolkits give the closest fit to each system.
InterviewWhat is inside a .docx file, and why is a nearly empty Word document several kilobytes?
A .docx file is a zip archive containing a set of XML files: one holding the document's text with its formatting, others holding style definitions, settings, relationships between parts and any images or fonts. Even with almost no text, the archive includes all these structural files and default styles, so it occupies several kilobytes, whereas the same few words saved as plain text take only as many bytes as there are characters.
StaffA team is choosing between a native toolkit and a web-based framework for an internal photo-review desktop tool used all day by a small team on Windows only. Advise them.
The deciding facts are a single platform, all-day use and a small, known user group. Those favour a native toolkit such as WinUI: it follows Windows's design language and accessibility conventions automatically, starts fast, uses less memory over long sessions, and integrates with system features such as file pickers and notifications. A web-based framework's main advantage, one codebase across Windows, macOS and Linux, does not apply here.
The case for a web-based approach would be if the team already has strong web skills and no native experience, if the tool must share most of its code with the existing web admin page, or if other platforms are likely later. In that case, prefer a framework that uses the system's built-in web engine to keep memory and size down. Either way, keep heavy work such as image decoding off the interface thread, so the window never stops responding.
Scenario Drill
DrillThe photo-upload service exports photo captions as .txt files, and a client complains that the bold product names they typed into the web form have disappeared from the exports. Using this page, explain why and propose options.
A .txt file is plain text: it can hold only characters, with no place to record that a word is bold. If the web form's bold formatting is exported to .txt, the formatting has nowhere to go, so only the words remain. Nothing was lost by accident; the format cannot carry it.
Options, depending on what the client needs:
- Markdown in a
.mdor.txtfile. Bold becomes**word**. It is still plain text that any program can read, and tools that understand Markdown display it as bold. - HTML. Bold becomes
<b>word</b>, which any browser displays correctly. - A rich document format such as
.docxor.rtf, if the client will open the exports in a word processor.
Choose by who reads the files next. Then state the format clearly in the export, so nobody expects formatting from a file type that cannot hold it.
Next: Part 2 built the operating system that runs programs. Part 3 climbs one level higher, to the languages, compilers and runtimes that turn the source code you write into the processes this Part knows how to run, starting with 3.1.