1-Bit Classic Macintosh
Pure black-and-white 1-bit stipple desktop, striped titlebars, dropdown menu bar, and MacPaint pixel sketchpad.
Inspired by Infinite Mac ↗
WHY THIS AESTHETIC IS UNIQUE
Distills interface design down to Susan Kare's iconic 1-bit monochrome vocabulary: zero gray anti-aliasing, pure checkerboard dithering, and instant crispness.
BEST FOR
TAGS
COLOR PALETTE (CLICK TO COPY HEX)
TYPOGRAPHY
- Display
- Silkscreen
- Body
- IBM Plex Mono
- Mono
- IBM Plex Mono
- Scale
- Crisp bitmap-style menu bar and window headers in pure black/white inversion with zero blurry anti-aliasing.
ARCHITECTURE & MOBILE NOTES
LAYOUT
Full-width top menu bar (File, Edit, Special) above a 50% CSS-dithered desktop featuring a MacPaint-style pixel canvas window and an 'About This Macintosh' memory bar dialog.
INTERACTION
Working dropdown menus, interactive click/drag 1-bit pixel drawing canvas with brush pattern switcher (Solid, Stipple, Eraser, Clear), and live memory allocation bar.
MOBILE
Adapts the MacPaint canvas and About dialog into a clean single-column stack at 390px with >=44px pattern tool buttons and touch-drawing support.
AI AGENT GUARDRAILS
DO
- Restrict the entire UI strictly to pure #000000 and #FFFFFF, using CSS checkerboard stipple patterns for gray tones.
- Invert selected menu items and active buttons from black-on-white to white-on-black.
- Render window titlebars with classic 6-line horizontal black stripes.
DON'T
- Never introduce chromatic accents, drop-shadow blur, or soft gray gradients.
- Avoid breaking the 1-bit illusion with photographic or smoothly shaded icons.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Macintosh System 7 — 1-Bit Monochrome</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--black: #000000;
--white: #ffffff;
--font-mac: 'Silkscreen', 'Chicago', 'Geneva', 'Courier New', monospace;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
min-height: 100%;
width: 100%;
overflow-x: hidden;
font-family: var(--font-mac);
font-size: 12px;
color: var(--black);
background-color: var(--white);
/* Authentic 1-bit 50% checkerboard dither pattern */
background-image:
linear-gradient(45deg, #000 25%, transparent 25%),
linear-gradient(-45deg, #000 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, #000 75%),
linear-gradient(-45deg, transparent 75%, #000 75%);
background-size: 4px 4px;
background-position: 0 0, 0 2px, 2px -2px, -2px 0;
image-rendering: pixelated;
}
body.dense-stipple {
background-size: 2px 2px;
background-position: 0 0, 0 1px, 1px -1px, -1px 0;
}
/* Classic 1-Bit Menu Bar */
.mac-menubar {
position: sticky;
top: 0;
z-index: 600;
display: flex;
align-items: center;
justify-content: space-between;
min-height: 44px;
padding: 0 8px;
background: var(--white);
border-bottom: 2px solid var(--black);
user-select: none;
}
.menu-left {
display: flex;
align-items: stretch;
gap: 2px;
}
.menu-trigger-wrap {
position: relative;
}
.menu-trigger {
min-height: 42px;
padding: 6px 10px;
background: var(--white);
border: 0;
font-family: var(--font-mac);
font-size: 12px;
color: var(--black);
cursor: pointer;
}
.menu-trigger:hover, .menu-trigger.open {
background: var(--black);
color: var(--white);
}
.menu-dropdown {
position: absolute;
top: 100%;
left: 0;
min-width: 196px;
background: var(--white);
border: 2px solid var(--black);
box-shadow: 3px 3px 0 var(--black);
list-style: none;
display: none;
z-index: 700;
}
.menu-dropdown.open {
display: block;
}
.menu-dropdown button {
width: 100%;
min-height: 40px;
padding: 6px 12px;
background: var(--white);
border: 0;
text-align: left;
font-family: var(--font-mac);
font-size: 11px;
color: var(--black);
cursor: pointer;
}
.menu-dropdown button:hover {
background: var(--black);
color: var(--white);
}
.menu-sep {
height: 2px;
background: repeating-linear-gradient(90deg, #000 0, #000 2px, #fff 2px, #fff 4px);
margin: 2px 0;
}
.mac-clock {
font-size: 11px;
padding: 4px 6px;
}
/* Desktop Surface */
.mac-desktop {
width: 100%;
max-width: 1020px;
margin: 0 auto;
padding: 14px 10px 32px;
display: grid;
grid-template-columns: 1fr;
gap: 16px;
align-items: start;
}
/* 1-Bit Classic Window */
.mac-window {
background: var(--white);
border: 2px solid var(--black);
box-shadow: 3px 3px 0 var(--black);
width: 100%;
overflow: hidden;
}
.mac-window.hidden-win {
display: none;
}
.mac-titlebar {
display: flex;
align-items: center;
gap: 8px;
min-height: 32px;
padding: 4px 6px;
border-bottom: 2px solid var(--black);
background: var(--white);
user-select: none;
}
.mac-stripes {
flex: 1;
height: 15px;
background: repeating-linear-gradient(
to bottom,
#000 0px,
#000 2px,
#fff 2px,
#fff 4px
);
}
.mac-title {
padding: 0 8px;
background: var(--white);
font-size: 11px;
white-space: nowrap;
}
.mac-close {
width: 22px;
height: 22px;
min-width: 22px;
border: 2px solid var(--black);
background: var(--white);
cursor: pointer;
display: grid;
place-items: center;
font-family: var(--font-mac);
font-size: 11px;
color: var(--black);
}
.mac-close:hover {
background: var(--black);
color: var(--white);
}
.mac-body {
padding: 12px;
display: flex;
flex-direction: column;
gap: 12px;
}
/* 1-Bit Buttons */
.mac-btn {
min-height: 44px;
padding: 6px 12px;
background: var(--white);
color: var(--black);
border: 2px solid var(--black);
border-radius: 6px;
font-family: var(--font-mac);
font-size: 11px;
cursor: pointer;
}
.mac-btn:hover, .mac-btn.active {
background: var(--black);
color: var(--white);
}
.mac-btn.default-btn {
box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--black);
}
/* MacPaint Workspace */
.paint-toolbar {
display: flex;
flex-wrap: wrap;
gap: 6px;
align-items: center;
}
.pattern-strip {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 6px;
}
.pat-btn {
min-height: 44px;
padding: 4px;
border: 2px solid var(--black);
background: var(--white);
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
font-family: var(--font-mac);
font-size: 9px;
color: var(--black);
}
.pat-btn.active {
background: var(--black);
color: var(--white);
}
.pat-swatch {
width: 28px;
height: 16px;
border: 1.5px solid var(--black);
background: var(--white);
}
.pat-btn.active .pat-swatch {
border-color: var(--white);
}
.canvas-frame {
border: 2px solid var(--black);
background: var(--white);
overflow: hidden;
}
#macpaint-canvas {
display: block;
width: 100%;
height: auto;
cursor: crosshair;
touch-action: none;
image-rendering: pixelated;
}
.paint-status {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
font-size: 10px;
border-top: 2px solid var(--black);
padding-top: 8px;
}
/* About This Macintosh Window */
.about-header {
display: flex;
align-items: center;
gap: 12px;
border-bottom: 2px solid var(--black);
padding-bottom: 10px;
}
.about-meta {
display: flex;
flex-direction: column;
gap: 4px;
font-size: 11px;
}
.mem-stats {
display: grid;
grid-template-columns: 1fr auto;
gap: 6px;
font-size: 11px;
}
.mem-list {
border: 2px solid var(--black);
padding: 8px;
display: flex;
flex-direction: column;
gap: 10px;
}
.mem-row {
display: flex;
flex-direction: column;
gap: 4px;
}
.mem-label {
display: flex;
justify-content: space-between;
font-size: 10px;
}
.mem-bar-track {
height: 14px;
border: 2px solid var(--black);
background: var(--white);
position: relative;
}
.mem-bar-fill {
height: 100%;
background-image:
linear-gradient(45deg, #000 25%, transparent 25%),
linear-gradient(-45deg, #000 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, #000 75%),
linear-gradient(-45deg, transparent 75%, #000 75%);
background-size: 4px 4px;
background-position: 0 0, 0 2px, 2px -2px, -2px 0;
border-right: 2px solid var(--black);
}
.mem-bar-fill.solid {
background: var(--black);
}
/* Desktop Icons Strip */
.mac-icons-row {
display: flex;
flex-wrap: wrap;
gap: 14px;
justify-content: flex-start;
}
.mac-desk-icon {
min-width: 84px;
min-height: 76px;
padding: 6px;
background: transparent;
border: 0;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
font-family: var(--font-mac);
font-size: 10px;
color: var(--black);
}
.mac-desk-icon span {
background: var(--white);
border: 1px solid var(--black);
padding: 2px 5px;
}
.mac-desk-icon:hover span {
background: var(--black);
color: var(--white);
}
/* Classic Alert Banner */
.mac-alert {
position: fixed;
bottom: 14px;
left: 50%;
transform: translateX(-50%);
background: var(--white);
border: 3px double var(--black);
box-shadow: 4px 4px 0 var(--black);
padding: 10px 14px;
font-size: 11px;
z-index: 800;
display: none;
max-width: calc(100vw - 24px);
text-align: center;
}
.mac-alert.show {
display: block;
}
@media (min-width: 840px) {
.mac-desktop {
grid-template-columns: 1.35fr 0.95fr;
padding: 22px 20px 40px;
gap: 20px;
}
.right-col {
display: flex;
flex-direction: column;
gap: 18px;
}
.mac-icons-row {
justify-content: flex-end;
}
}
</style>
</head>
<body>
<!-- TOP SYSTEM 7 MENU BAR -->
<header class="mac-menubar" role="banner">
<div class="menu-left">
<div class="menu-trigger-wrap">
<button class="menu-trigger" data-menu="m-apple" aria-expanded="false">◆ Mac</button>
<ul class="menu-dropdown" id="m-apple">
<li><button data-action="show-about">About This Macintosh...</button></li>
<li class="menu-sep"></li>
<li><button data-action="show-paint">Open MacPaint 2.0</button></li>
<li><button data-action="toggle-stipple">Toggle 1-Bit Stipple</button></li>
</ul>
</div>
<div class="menu-trigger-wrap">
<button class="menu-trigger" data-menu="m-file" aria-expanded="false">File</button>
<ul class="menu-dropdown" id="m-file">
<li><button data-action="clear-canvas">New Blank Canvas</button></li>
<li><button data-action="restore-art">Load Macintosh Sketch</button></li>
<li class="menu-sep"></li>
<li><button data-action="show-all">Show All Windows</button></li>
</ul>
</div>
<div class="menu-trigger-wrap">
<button class="menu-trigger" data-menu="m-edit" aria-expanded="false">Edit</button>
<ul class="menu-dropdown" id="m-edit">
<li><button data-action="invert-canvas">Invert 1-Bit Pixels</button></li>
<li><button data-action="stamp-happy">Stamp Happy Mac</button></li>
</ul>
</div>
<div class="menu-trigger-wrap">
<button class="menu-trigger" data-menu="m-special" aria-expanded="false">Special</button>
<ul class="menu-dropdown" id="m-special">
<li><button data-action="clean-up">Clean Up Desktop</button></li>
<li><button data-action="empty-trash">Empty Trash</button></li>
<li class="menu-sep"></li>
<li><button data-action="restart">Restart Chime</button></li>
</ul>
</div>
</div>
<div class="mac-clock" id="mac-clock">9:41 AM</div>
</header>
<main class="mac-desktop">
<!-- LEFT: MACPAINT 1-BIT PIXEL STUDIO -->
<section class="mac-window" id="win-paint" aria-label="MacPaint 1-Bit Studio">
<div class="mac-titlebar">
<button class="mac-close" data-close="win-paint" aria-label="Close MacPaint">×</button>
<div class="mac-stripes"></div>
<span class="mac-title">MacPaint — untitled.pnt</span>
<div class="mac-stripes"></div>
</div>
<div class="mac-body">
<div class="pattern-strip" id="pattern-strip" aria-label="1-bit pattern brushes">
<button class="pat-btn active" data-pat="solid">
<span class="pat-swatch" style="background:#000;"></span>Solid
</button>
<button class="pat-btn" data-pat="checker">
<span class="pat-swatch" style="background:repeating-conic-gradient(#000 0% 25%, #fff 0% 50%) 50% / 6px 6px;"></span>50%
</button>
<button class="pat-btn" data-pat="diag">
<span class="pat-swatch" style="background:repeating-linear-gradient(-45deg,#000,#000 2px,#fff 2px,#fff 5px);"></span>Hatch
</button>
<button class="pat-btn" data-pat="vert">
<span class="pat-swatch" style="background:repeating-linear-gradient(90deg,#000,#000 2px,#fff 2px,#fff 4px);"></span>Lines
</button>
<button class="pat-btn" data-pat="erase">
<span class="pat-swatch" style="background:#fff;"></span>Erase
</button>
</div>
<div class="paint-toolbar">
<button class="mac-btn active" data-size="2">Brush 2px</button>
<button class="mac-btn" data-size="6">Brush 6px</button>
<button class="mac-btn" data-size="12">Brush 12px</button>
<button class="mac-btn" id="btn-invert">Invert</button>
<button class="mac-btn" id="btn-clear">Clear</button>
</div>
<div class="canvas-frame">
<canvas id="macpaint-canvas" width="320" height="210"></canvas>
</div>
<div class="paint-status">
<span id="paint-readout">TOOL: SOLID 2PX</span>
<span id="pixel-xy">X: 000 Y: 000</span>
</div>
</div>
</section>
<!-- RIGHT COLUMN: ABOUT THIS MACINTOSH + DESKTOP ICONS -->
<div class="right-col">
<section class="mac-window" id="win-about" aria-label="About This Macintosh">
<div class="mac-titlebar">
<button class="mac-close" data-close="win-about" aria-label="Close About This Macintosh">×</button>
<div class="mac-stripes"></div>
<span class="mac-title">About This Macintosh</span>
<div class="mac-stripes"></div>
</div>
<div class="mac-body">
<div class="about-header">
<svg width="46" height="52" viewBox="0 0 46 52" aria-hidden="true">
<rect x="3" y="2" width="40" height="48" rx="4" fill="#fff" stroke="#000" stroke-width="2.5"/>
<rect x="9" y="8" width="28" height="20" fill="#fff" stroke="#000" stroke-width="2"/>
<rect x="16" y="13" width="3" height="3" fill="#000"/>
<rect x="27" y="13" width="3" height="3" fill="#000"/>
<path d="M18 22h10M17 20h2M27 20h2" stroke="#000" stroke-width="2"/>
<rect x="24" y="34" width="13" height="3" fill="#000"/>
<rect x="9" y="34" width="6" height="4" fill="#000"/>
<path d="M3 42h40" stroke="#000" stroke-width="2"/>
</svg>
<div class="about-meta">
<strong>Macintosh Classic II</strong>
<span>System Software 7.1</span>
<span>1-Bit Monochrome Display</span>
</div>
</div>
<div class="mem-stats">
<span>Total Memory:</span><strong>8,192 K</strong>
<span>Largest Unused Block:</span><strong id="unused-mem">5,312 K</strong>
</div>
<div class="mem-list">
<div class="mem-row">
<div class="mem-label">
<span>System Software</span>
<span>1,856 K</span>
</div>
<div class="mem-bar-track">
<div class="mem-bar-fill solid" style="width: 34%;"></div>
</div>
</div>
<div class="mem-row">
<div class="mem-label">
<span>MacPaint 2.0</span>
<span id="paint-mem">1,024 K</span>
</div>
<div class="mem-bar-track">
<div class="mem-bar-fill" id="paint-mem-bar" style="width: 24%;"></div>
</div>
</div>
</div>
<div style="display:flex; justify-content:flex-end;">
<button class="mac-btn default-btn" id="btn-ram-check">Verify RAM</button>
</div>
</div>
</section>
<div class="mac-icons-row" aria-label="Desktop Icons">
<button class="mac-desk-icon" data-action="show-about">
<svg width="38" height="38" viewBox="0 0 38 38" aria-hidden="true">
<rect x="5" y="10" width="28" height="20" fill="#fff" stroke="#000" stroke-width="2"/>
<path d="M5 16h28" stroke="#000" stroke-width="2"/>
<rect x="24" y="21" width="5" height="3" fill="#000"/>
</svg>
<span>Macintosh HD</span>
</button>
<button class="mac-desk-icon" data-action="show-paint">
<svg width="38" height="38" viewBox="0 0 38 38" aria-hidden="true">
<rect x="6" y="4" width="26" height="30" fill="#fff" stroke="#000" stroke-width="2"/>
<path d="M11 26l16-16M13 12h6M19 26h8" stroke="#000" stroke-width="2"/>
</svg>
<span>MacPaint</span>
</button>
<button class="mac-desk-icon" data-action="empty-trash">
<svg width="38" height="38" viewBox="0 0 38 38" aria-hidden="true">
<rect x="11" y="11" width="16" height="22" fill="#fff" stroke="#000" stroke-width="2"/>
<path d="M8 11h22M15 7h8v4h-8zM15 16v12M19 16v12M23 16v12" stroke="#000" stroke-width="2"/>
</svg>
<span>Trash</span>
</button>
</div>
</div>
</main>
<div class="mac-alert" id="mac-alert" role="status" aria-live="polite"></div>
<script>
const canvas = document.getElementById('macpaint-canvas');
const ctx = canvas.getContext('2d');
const readout = document.getElementById('paint-readout');
const pixelXY = document.getElementById('pixel-xy');
const alertBox = document.getElementById('mac-alert');
let pattern = 'solid';
let brushSize = 2;
let isDrawing = false;
let strokeCount = 0;
let alertTimer;
function showAlert(msg) {
alertBox.textContent = msg;
alertBox.classList.add('show');
clearTimeout(alertTimer);
alertTimer = setTimeout(() => alertBox.classList.remove('show'), 2400);
}
function drawInitialSketch() {
ctx.fillStyle = '#ffffff';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// 1-bit dithered sky band
ctx.fillStyle = '#000000';
for (let y = 0; y < 90; y += 2) {
for (let x = (y % 4 === 0 ? 0 : 2); x < canvas.width; x += 4) {
ctx.fillRect(x, y, 1, 1);
}
}
// 1-bit sun
ctx.fillStyle = '#ffffff';
ctx.beginPath();
ctx.arc(256, 44, 22, 0, Math.PI * 2);
ctx.fill();
ctx.strokeStyle = '#000000';
ctx.lineWidth = 2;
ctx.stroke();
// Mountain ridge
ctx.fillStyle = '#ffffff';
ctx.beginPath();
ctx.moveTo(0, 150);
ctx.lineTo(74, 70);
ctx.lineTo(148, 134);
ctx.lineTo(206, 86);
ctx.lineTo(320, 150);
ctx.lineTo(320, 210);
ctx.lineTo(0, 210);
ctx.closePath();
ctx.fill();
ctx.stroke();
// Diagonal hatch shadow on left mountain
for (let i = 0; i < 60; i += 4) {
ctx.beginPath();
ctx.moveTo(74, 72 + i);
ctx.lineTo(74 + i * 0.9, 72 + i);
ctx.stroke();
}
// Classic Happy Mac icon in foreground
stampHappyMac(28, 136);
}
function stampHappyMac(x, y) {
ctx.fillStyle = '#ffffff';
ctx.fillRect(x, y, 42, 50);
ctx.strokeStyle = '#000000';
ctx.lineWidth = 2;
ctx.strokeRect(x, y, 42, 50);
ctx.strokeRect(x + 6, y + 6, 30, 20);
ctx.fillStyle = '#000000';
ctx.fillRect(x + 13, y + 12, 3, 3);
ctx.fillRect(x + 26, y + 12, 3, 3);
ctx.fillRect(x + 15, y + 20, 12, 2);
ctx.fillRect(x + 22, y + 34, 14, 3);
ctx.fillRect(x + 6, y + 34, 6, 4);
}
function shouldFillPixel(px, py) {
if (pattern === 'solid') return true;
if (pattern === 'erase') return false;
if (pattern === 'checker') return (px + py) % 2 === 0;
if (pattern === 'diag') return (px + py) % 4 === 0;
if (pattern === 'vert') return px % 3 === 0;
return true;
}
function plotBrush(cx, cy) {
const half = Math.floor(brushSize / 2);
for (let dy = -half; dy <= half; dy++) {
for (let dx = -half; dx <= half; dx++) {
const px = cx + dx;
const py = cy + dy;
if (px < 0 || py < 0 || px >= canvas.width || py >= canvas.height) continue;
if (pattern === 'erase') {
ctx.fillStyle = '#ffffff';
ctx.fillRect(px, py, 1, 1);
} else if (shouldFillPixel(px, py)) {
ctx.fillStyle = '#000000';
ctx.fillRect(px, py, 1, 1);
}
}
}
}
function getPt(e) {
const r = canvas.getBoundingClientRect();
return {
x: Math.floor(((e.clientX - r.left) / r.width) * canvas.width),
y: Math.floor(((e.clientY - r.top) / r.height) * canvas.height)
};
}
canvas.addEventListener('pointerdown', (e) => {
isDrawing = true;
canvas.setPointerCapture(e.pointerId);
const pt = getPt(e);
plotBrush(pt.x, pt.y);
strokeCount += 1;
const usedKb = Math.min(2048, 1024 + strokeCount * 8);
document.getElementById('paint-mem').textContent = `${usedKb.toLocaleString()} K`;
document.getElementById('paint-mem-bar').style.width = `${Math.min(72, 24 + strokeCount)}%`;
});
canvas.addEventListener('pointermove', (e) => {
const pt = getPt(e);
pixelXY.textContent = `X: ${String(pt.x).padStart(3, '0')} Y: ${String(pt.y).padStart(3, '0')}`;
if (isDrawing) plotBrush(pt.x, pt.y);
});
canvas.addEventListener('pointerup', () => { isDrawing = false; });
function invertCanvas() {
const img = ctx.getImageData(0, 0, canvas.width, canvas.height);
const d = img.data;
for (let i = 0; i < d.length; i += 4) {
const inv = d[i] > 127 ? 0 : 255;
d[i] = d[i + 1] = d[i + 2] = inv;
}
ctx.putImageData(img, 0, 0);
}
// Pattern & Size Switchers
document.getElementById('pattern-strip').addEventListener('click', (e) => {
const btn = e.target.closest('.pat-btn');
if (!btn) return;
pattern = btn.dataset.pat;
document.querySelectorAll('.pat-btn').forEach(b => b.classList.toggle('active', b === btn));
readout.textContent = `TOOL: ${pattern.toUpperCase()} ${brushSize}PX`;
});
document.querySelectorAll('[data-size]').forEach(btn => {
btn.addEventListener('click', () => {
brushSize = Number(btn.dataset.size);
document.querySelectorAll('[data-size]').forEach(b => b.classList.toggle('active', b === btn));
readout.textContent = `TOOL: ${pattern.toUpperCase()} ${brushSize}PX`;
});
});
document.getElementById('btn-invert').addEventListener('click', invertCanvas);
document.getElementById('btn-clear').addEventListener('click', () => {
ctx.fillStyle = '#ffffff';
ctx.fillRect(0, 0, canvas.width, canvas.height);
});
document.getElementById('btn-ram-check').addEventListener('click', () => {
showAlert('8,192 K RAM Verified — 0 Bad Blocks');
});
// Menu Bar Dropdowns
function closeAllMenus() {
document.querySelectorAll('.menu-trigger').forEach(t => {
t.classList.remove('open');
t.setAttribute('aria-expanded', 'false');
});
document.querySelectorAll('.menu-dropdown').forEach(d => d.classList.remove('open'));
}
document.querySelectorAll('.menu-trigger').forEach(trigger => {
trigger.addEventListener('click', (e) => {
e.stopPropagation();
const menu = document.getElementById(trigger.dataset.menu);
const alreadyOpen = menu.classList.contains('open');
closeAllMenus();
if (!alreadyOpen) {
menu.classList.add('open');
trigger.classList.add('open');
trigger.setAttribute('aria-expanded', 'true');
}
});
});
document.addEventListener('click', closeAllMenus);
function handleAction(act) {
closeAllMenus();
if (act === 'show-about') document.getElementById('win-about').classList.remove('hidden-win');
if (act === 'show-paint') document.getElementById('win-paint').classList.remove('hidden-win');
if (act === 'show-all') {
document.getElementById('win-about').classList.remove('hidden-win');
document.getElementById('win-paint').classList.remove('hidden-win');
}
if (act === 'clear-canvas') {
ctx.fillStyle = '#ffffff';
ctx.fillRect(0, 0, canvas.width, canvas.height);
}
if (act === 'restore-art') drawInitialSketch();
if (act === 'invert-canvas') invertCanvas();
if (act === 'stamp-happy') {
stampHappyMac(20 + Math.floor(Math.random() * 240), 20 + Math.floor(Math.random() * 120));
}
if (act === 'toggle-stipple') document.body.classList.toggle('dense-stipple');
if (act === 'clean-up') showAlert('Desktop icons aligned to 1-bit grid.');
if (act === 'empty-trash') showAlert('Trash is already empty (0 K reclaimed).');
if (act === 'restart') showAlert('BONG! Macintosh Classic II ready.');
}
document.querySelectorAll('[data-action]').forEach(el => {
el.addEventListener('click', () => handleAction(el.dataset.action));
});
document.querySelectorAll('[data-close]').forEach(btn => {
btn.addEventListener('click', () => {
document.getElementById(btn.dataset.close).classList.add('hidden-win');
showAlert('Reopen windows from the Apple or File menu.');
});
});
function tickClock() {
document.getElementById('mac-clock').textContent = new Date().toLocaleTimeString([], {
hour: 'numeric',
minute: '2-digit'
});
}
drawInitialSketch();
tickClock();
setInterval(tickClock, 1000);
</script>
</body>
</html>